MCPcopy Create free account
hub / github.com/Neargye/magic_enum / main

Function main

example/example_custom_name.cpp:58–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int main() {
59 std::cout << magic_enum::enum_name(Color::RED) << std::endl; // 'the red color'
60 std::cout << magic_enum::enum_name(Color::BLUE) << std::endl; // 'The BLUE'
61 std::cout << magic_enum::enum_name(Color::GREEN) << std::endl; // ''
62
63 std::cout << std::boolalpha;
64 std::cout << (magic_enum::enum_cast<Color>("the red color").value() == Color::RED) << std::endl; // true
65
66 std::cout << magic_enum::enum_name(Numbers::One) << std::endl; // 'the one'
67 std::cout << magic_enum::enum_name(Numbers::Two) << std::endl; // 'Two'
68 std::cout << magic_enum::enum_name(Numbers::Three) << std::endl; // 'Three'
69
70 return 0;
71}

Callers

nothing calls this directly

Calls 2

enum_nameFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected