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.98k stars 444 forks source link

magic_enum::enum_name Fails on large enums #357

Closed Antidote closed 5 months ago

Antidote commented 5 months ago

I have a particularly large enum that I want to be able to print the names of for debugging purposes and for some reason magic_enum fails after 18 values, I think it's related to how count_v calculates the number of entries at compile time but I'm not knowledgeable enough on metaprogramming to really puzzle through it.

I've included the large enum as a gist so as not to clog up the issue: https://gist.github.com/Antidote/329c6576091ae6dd017e3743e05248fb

If you have any suggestions or workarounds I'd be greatly appreciative, or even a quick patch I could try.

Neargye commented 5 months ago

By default, only values within [-128, 127] are visible to magic_enum. More info here: https://github.com/Neargye/magic_enum/blob/master/doc/limitations.md#enum-range You can customize the allowed range globally (for all enums) or for each enum individually.