1
0
Fork 0
mirror of https://github.com/Neargye/magic_enum.git synced 2026-01-09 23:34:23 +00:00

add type_traits example

This commit is contained in:
neargye 2019-04-08 19:18:43 +05:00
parent f08837e1ae
commit 05c2b7dc84

View file

@ -74,5 +74,16 @@ int main() {
std::cout << std::endl;
// Color sequence: RED BLUE GREEN
enum color { red, green, blue };
enum class direction { left, right };
// Checks whether type is an Unscoped enumeration.
static_assert(magic_enum::is_unscoped_enum_v<color>);
static_assert(!magic_enum::is_unscoped_enum_v<direction>);
// Checks whether type is an Scoped enumeration.
static_assert(!magic_enum::is_scoped_enum_v<color>);
static_assert(magic_enum::is_scoped_enum_v<direction>);
return 0;
}