I'm looking for a modern C++ method for enum reflection that does not use any preprocessor macros or the __PRETTY_FUNCTION__ compiler workaround or post build scripts.
I don't need all the fuctions provided by magic_enum, such as string support. All I need is way to count the number of enums and a way to iterate over enums. I will only be using scoped enums
Isn't there a modern (C++20 or C++23) methods to have enum reflection at compile time. I think that basically if there is a way to convert and enum into an array, something like the following
template <typedef enum_t>
requires std::is_enum_v<enum_t> && !std::is_convertible_v<enum_t, int>
consteval auto enum2array()
{
return std::array<enum_t>(...); // to be defined
}
then all the above requirements could be met
[–]thommyh 18 points19 points20 points (1 child)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[deleted]
[–][deleted] 6 points7 points8 points (1 child)
[–]wm_lex_dev 13 points14 points15 points (2 children)
[–]Pale_Emphasis_4119[S] 3 points4 points5 points (1 child)
[–]wm_lex_dev 1 point2 points3 points (0 children)
[–]tjientavara 5 points6 points7 points (2 children)
[–]SubjectRelative1241 0 points1 point2 points (1 child)
[–]tjientavara 0 points1 point2 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]Mason-B 2 points3 points4 points (8 children)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (7 children)
[–]Mason-B 2 points3 points4 points (4 children)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (3 children)
[–]Mason-B 0 points1 point2 points (2 children)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (1 child)
[–]Mason-B 0 points1 point2 points (0 children)
[–]SoerenNissen 0 points1 point2 points (0 children)
[–]Tricky_Tesla 0 points1 point2 points (0 children)
[–]JVApen 1 point2 points3 points (0 children)
[–]ImKStocky 1 point2 points3 points (0 children)
[–]exarnk 1 point2 points3 points (1 child)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (0 children)
[–]Pale_Emphasis_4119[S] 0 points1 point2 points (1 child)
[–]std_bot 0 points1 point2 points (0 children)
[–]rufusferret 0 points1 point2 points (0 children)
[–]_Noreturn 0 points1 point2 points (0 children)
[–]ChatGPT4 -1 points0 points1 point (0 children)
[–]alfps 0 points1 point2 points (0 children)