Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 6 commits into from
Jan 26, 2023

Conversation

pwojcikdev
Copy link
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
@@ -29,3 +29,6 @@
[submodule "boost"]
path = boost
url = https://github.com/boostorg/boost.git
[submodule "magic_enum"]
path = magic_enum
Copy link
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
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
Contributor Author

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

@clemahieu clemahieu merged commit 6281105 into nanocurrency:develop Jan 26, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants