Replies: 1 comment 2 replies
-
|
Thanks for sharing this, that is an elegant approach. I'll add something to the documentation about this. Glaze also support separate keys and value arrays, which should compile faster: template <class T>
requires std::is_enum_v<T>
struct meta<T>
{
static constexpr auto keys = magic_enum::enum_names<T>();
static constexpr auto value = magic_enum::enum_values<T>();
}; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation suggests to use simple_enum for automatic enum-to-string conversions. Unfortunately simple_enum doesn't seem to support Glaze 6. I was however able to automatically convert all enums to strings using magic_enum. I believe simple_enum has a similar facility and could be used as well. Here's the code. Short enough to be included in documentation?
Beta Was this translation helpful? Give feedback.
All reactions