Skip to content

is_wise_enum_class and is_wise_enum_vanilla? #47

@sahilsharma-github

Description

@sahilsharma-github

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions