Function str2e

Synopsis

#include <src/c4/enum.hpp>

template <class Enum>
Enum str2e(const char *str)

Description

get the enum value corresponding to a c-string

Mentioned in

Source

Lines 157-164 in src/c4/enum.hpp.

template<class Enum>
Enum str2e(const char* str)
{
    auto pairs = esyms<Enum>();
    auto *p = pairs.get(str);
    C4_CHECK_MSG(p != nullptr, "no valid enum pair name for '%s'", str);
    return p->value;
}





Add Discussion as Guest

Log in