std::string enum_to_string(ENUM_TYPE e) { \
static_assert(std::is_enum<ENUM_TYPE>::value, \
#ENUM_TYPE " must be an enum!"); \
static const std::pair<ENUM_TYPE, std::string> m[] = __VA_ARGS__; \
auto it = std::find_if( \
std::begin(m), std::end(m), \
[e](const std::pair<ENUM_TYPE, std::string> &es_pair) \
-> bool { return es_pair.first == e; }); \
return ((it != std::end(m)) ? it : std::begin(m))->second; \
} \
void enum_from_string(const std::string &str, ENUM_TYPE &e) { \
static_assert(std::is_enum<ENUM_TYPE>::value, \
#ENUM_TYPE " must be an enum!"); \
static const std::pair<ENUM_TYPE, std::string> m[] = __VA_ARGS__; \
auto it = std::find_if( \
std::begin(m), std::end(m), \
[&str](const std::pair<ENUM_TYPE, std::string> &es_pair) \
-> bool { return es_pair.second == str; }); \
e = ((it != std::end(m)) ? it : std::begin(m))->first;
\ }
void LogDebug(const char *format, const Args &... args)
Definition: Console.h:191