Use 'magic_enum' library for static reflection for enums#4065
Merged
clemahieu merged 6 commits intonanocurrency:developfrom Jan 26, 2023
Merged
Use 'magic_enum' library for static reflection for enums#4065clemahieu merged 6 commits intonanocurrency:developfrom
clemahieu merged 6 commits intonanocurrency:developfrom
Conversation
9f41a5e to
5eb0c59
Compare
03a68ec to
5805a54
Compare
clemahieu
approved these changes
Jan 23, 2023
clemahieu
reviewed
Jan 23, 2023
.gitmodules
Outdated
| path = boost | ||
| url = https://github.com/boostorg/boost.git | ||
| [submodule "magic_enum"] | ||
| path = magic_enum |
Contributor
There was a problem hiding this comment.
Has this been corrected for the new submodule directory?
96f087c to
cba027d
Compare
Contributor
Author
|
@clemahieu Moved library to the submodules folder, need your OK to merge. |
dsiganos
approved these changes
Jan 25, 2023
clemahieu
approved these changes
Jan 26, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is cumbersome to convert between enum and string representations, because C++ standard does not provide any tools for that purpose. Currently our codebase requires writing manual conversion functions which is inefficient and inflexible. This PR introduces
magic_enum(https://github.com/Neargye/magic_enum) library as a submodule, which ergonomically handles enum to string conversions without requiring any adaptations to existing enum definitions.The PR only modifies stat related classes (
stat::typeandstat::detail). More conversions will be done in subsequent PRs.Compiler compatibility for
magic_enum: