magic_enum

Static reflection library for enums in modern C++

brewmacoslinux
Try with needOr install directly
Source

About

Static reflection for enums (to string, from string, iteration) for modern C++

Commands

magic_enum

Examples

Include magic_enum header in C++ project for enum reflection$ #include <magic_enum.hpp>
Convert enum value to string at compile-time$ auto name = magic_enum::enum_name(MyEnum::Value);
Convert string to enum value with type safety$ auto value = magic_enum::enum_cast<MyEnum>("Value");