You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Defined once and reused
#defineSERIALIZE_ENUM(NAMESPACE, ENUM) SERIALIZE(NAMESPACE, ENUM, MAGIC_ENUM_VALUES(NAMESPACE##ENUM))
// Called for each enumSERIALIZE_ENUM(ns, MyEnum)
The text was updated successfully, but these errors were encountered:
It is a nice idea, but I do not think it's possible. magic_enum extract the info about enums using metaprogramming and AFAIK there is no way to propagate this information to the preprocessor.
Also, if there would be a way to parse enums at preprocessor-time, I'm sure someone would have already implemented it.
Various third party libraries provide preprocessor macros that process enum values. A classic example is for serializing and deserializing enums.
It would reduce duplication and errors if magic_enum could support extracting enum values in a preprocessor context
which would then allow the user to do something like the following
SERIALIZE(ns, MyEnum, MAGIC_ENUM_VALUES(ns##MyEnum))
or even simpler
The text was updated successfully, but these errors were encountered: