Код: Выделить всё
enum class Foo : int
{
a,
b,
c,
totalNum
}
< /code>
У других нет этого, как < /p>
enum class Bar : bool
{
oneOption,
otherOption
}
< /code>
Тогда у меня есть функция, в основном такая, что < /p>
template
EnumClassType typeToEnum (typename std::underlying_type::type value)
{
// If you hit this assertion, the value is outside of the valid enum range
assert (isPositiveAndBelow (value, decltype (value) (EnumClassType::totalNum)));
return EnumClassType (value);
}
Подробнее здесь: https://stackoverflow.com/questions/684 ... -identfier
Мобильная версия