logoalt Hacker News

trealira • today at 6:36 PM • 0 replies • view on HN

Why not simply write the following?

   const Config config { loadConfig() };
   for (auto &name : config.names) {
       use(name);
   }
Or else you could have "loadConfig()" be a method that returns a reference, which is in turn the member of a class, so that there isn't any dangling reference issue.