Neargye / magic_enum

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
MIT License
4.76k stars 422 forks source link

Help for magic_enum with large int (example provided) #326

Closed xcheng85 closed 8 months ago

xcheng85 commented 8 months ago

I have two enum values:

VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000,

I am using the following code to get the string value of enum keys:

            VkStructureType color = VkStructureType::VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO;
            auto color_name = magic_enum::enum_name(color);
            spdlog::info("{}", color_name);

magic_enum works for VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO

magic_enum returns "" for VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES.

Could you please help ? Thank you very much

Neargye commented 8 months ago

These errors mean that the library did not reflect all the enum values, enum size is too big.

Check more in https://github.com/Neargye/magic_enum/blob/master/doc/limitations.md