One more fix of the preceding commit.

This commit is contained in:
bubnikv 2017-10-17 17:48:04 +02:00
parent 38aca5047f
commit 67ce4d862b
2 changed files with 5 additions and 5 deletions

View File

@ -680,7 +680,7 @@ public:
static bool has(T value) static bool has(T value)
{ {
for (const std::map<std::string,int> &kvp : get_enum_values()) for (const std::pair<std::string, int> &kvp : ConfigOptionEnum<T>::get_enum_values())
if (kvp.second == value) if (kvp.second == value)
return true; return true;
return false; return false;
@ -694,11 +694,11 @@ public:
// Initialize the map. // Initialize the map.
const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values(); const t_config_enum_values &enum_keys_map = ConfigOptionEnum<T>::get_enum_values();
int cnt = 0; int cnt = 0;
for (auto &kvp : enum_keys_map) for (const std::pair<std::string, int> &kvp : enum_keys_map)
cnt = std::max(cnt, kvp.second); cnt = std::max(cnt, kvp.second);
cnt += 1; cnt += 1;
names.assign(cnt, ""); names.assign(cnt, "");
for (auto &kvp : enum_keys_map) for (const std::pair<std::string, int> &kvp : enum_keys_map)
names[kvp.second] = kvp.first; names[kvp.second] = kvp.first;
} }
return names; return names;
@ -998,7 +998,7 @@ protected:
class UnknownOptionException : public std::exception class UnknownOptionException : public std::exception
{ {
public: public:
const char* what() const override { return "Unknown config option"; } const char* what() const _NOEXCEPT override { return "Unknown config option"; }
}; };
} }

View File

@ -265,7 +265,7 @@ private: \
} \ } \
} \ } \
/* Cache object holding a key/option map, a list of option keys and a copy of this static config initialized with the defaults. */ \ /* Cache object holding a key/option map, a list of option keys and a copy of this static config initialized with the defaults. */ \
static StaticCache<CLASS_NAME> s_cache_##CLASS_NAME; static StaticPrintConfig::StaticCache<CLASS_NAME> s_cache_##CLASS_NAME;
#define STATIC_PRINT_CONFIG_CACHE(CLASS_NAME) \ #define STATIC_PRINT_CONFIG_CACHE(CLASS_NAME) \
STATIC_PRINT_CONFIG_CACHE_BASE(CLASS_NAME) \ STATIC_PRINT_CONFIG_CACHE_BASE(CLASS_NAME) \