 <p>Another way to do this would be to create a singleton class.</p> <pre><code>#include &lt;fstream&gt; #include &lt;map&gt; #include &lt;string&gt; class ConfigStore { public: static ConfigStore&amp; get() { static ConfigStore instance; return instance; } void parseFile(std::ifstream&amp; inStream); template&lt;typename _T&gt; _T getValue(std::string key); private: ConfigStore(){}; ConfigStore(const ConfigStore&amp;); ConfigStore&amp; operator=(const ConfigStore&amp;); std::map&lt;std::string,std::string&gt; storedConfig; }; </code></pre> <p>Here the configuration is saved in a map, meaning as long as parseFile can read the file and getValue can parse the type there is no need to recompile the config class if you add new keys.</p> <p>Usage:</p> <pre><code>std::ifstream input("somefile.txt"); ConfigStore::get().parseFile(input); std::cout&lt;&lt;ConfigStore::get().getValue&lt;std::string&gt;(std::string("thing"))&lt;&lt;std::endl; </code></pre>