1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

enum_integer_value -> enum_integer

This commit is contained in:
terik23 2019-04-30 11:42:31 +05:00
parent 39c5ed518d
commit 8f095f8c22
3 changed files with 13 additions and 13 deletions

View file

@ -54,9 +54,9 @@ int main() {
}
// Enum value to integer value.
auto color_integer_value = magic_enum::enum_integer_value(Color::RED);
if (color_integer_value == static_cast<std::underlying_type_t<Color>>(Color::RED)) {
std::cout << "RED = " << color_integer_value << std::endl; // RED = -10
auto color_integer = magic_enum::enum_integer(Color::RED);
if (color_integer == static_cast<std::underlying_type_t<Color>>(Color::RED)) {
std::cout << "RED = " << color_integer << std::endl; // RED = -10
}
using namespace magic_enum::ops; // out-of-the-box stream operator for enums.