Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

is_wise_enum_class and is_wise_enum_vanilla? #47

Open
sahilsharma-github opened this issue Aug 4, 2021 · 0 comments
Open

is_wise_enum_class and is_wise_enum_vanilla? #47

sahilsharma-github opened this issue Aug 4, 2021 · 0 comments

Comments

@sahilsharma-github
Copy link

sahilsharma-github commented Aug 4, 2021

I am using wise_enum library and i have a requirement to distinguish if something is an enum class or plain vanilla enum at compile time. wise enum provides a way to check if something is a wise_enum, which also implicitly means that it can tell us if something is an enumeration type. This is because wise_enum creates an actual scoped or unscoped class.

I looked into C++ standard to check if there is an existing type-trait that distinguishes between enum class and vanilla enum.
i found :
std::is_enum // again does not distinguish between scoped and unscoped enums
std::is_scoped_enum // exactly what i need, but unfortunately it's proposed for C++23

I think i am going to end up implementing this on my own. But i think it adds value to wise_enum also if it has this kind of type introspection available as C++23 is still a few years i think.

I am happy to add this enhancement to WISE_ENUM as well.

Interested in some feedback here!

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant