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:
parent
f08837e1ae
commit
05c2b7dc84
1 changed files with 11 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue