Skip to content

Use 'magic_enum' library for static reflection for enums#4065

Merged
clemahieu merged 6 commits intonanocurrency:developfrom
pwojcikdev:magic-enum
Jan 26, 2023
Merged

Use 'magic_enum' library for static reflection for enums#4065
clemahieu merged 6 commits intonanocurrency:developfrom
pwojcikdev:magic-enum

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

@pwojcikdev pwojcikdev commented Jan 21, 2023

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::type and stat::detail). More conversions will be done in subsequent PRs.

Compiler compatibility for magic_enum:

Clang/LLVM >= 6
MSVC++ >= 14.11 / Visual Studio >= 2017
Xcode >= 10
GCC >= 9
MinGW >= 9

.gitmodules Outdated
path = boost
url = https://github.com/boostorg/boost.git
[submodule "magic_enum"]
path = magic_enum
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been corrected for the new submodule directory?

Copy link
Copy Markdown
Contributor

@clemahieu clemahieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify submodule path

@pwojcikdev
Copy link
Copy Markdown
Contributor Author

@clemahieu Moved library to the submodules folder, need your OK to merge.

@pwojcikdev pwojcikdev requested a review from clemahieu January 25, 2023 12:44
@clemahieu clemahieu merged commit 6281105 into nanocurrency:develop Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants