#ifndef CONFIGS_H #define CONFIGS_H #include struct ConfigValueProxy { operator std::string() const { return convert(value); } operator float() const { return convert(value); } operator int() const { return convert(value); } operator bool() const { return convert(value); } std::string value; }; class Configs { public: bool load(const std::string& fileName); void save(); template void set(const std::string& key, const T& value) { m_confsMap[key] = convert(value); } ConfigValueProxy get(const std::string& key) { return ConfigValueProxy{m_confsMap[key]}; } private: std::string m_fileName; std::map m_confsMap; }; extern Configs g_configs; #endif // CONFIGS_H