mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
remove enum_traits (#38)
This commit is contained in:
parent
11b9c109b3
commit
2b9f24fd2c
5 changed files with 203 additions and 183 deletions
|
|
@ -10,6 +10,7 @@
|
|||
* [`enum_entries` obtains pair (value enum, string enum name) sequence.](#enum_entries)
|
||||
* [`enum_index` obtains index in enum value sequence from enum value.](#enum_index)
|
||||
* [`enum_contains` checks whether enum contains enumerator with such value.](#enum_contains)
|
||||
* [`enum_type_name` returns string name of enum type.](#enum_type_name)
|
||||
* [`is_unscoped_enum` checks whether type is an Unscoped enumeration.](#is_unscoped_enum)
|
||||
* [`is_scoped_enum` checks whether type is an Scoped enumeration.](#is_scoped_enum)
|
||||
* [`underlying_type` improved UB-free "SFINAE-friendly" std::underlying_type.](#underlying_type)
|
||||
|
|
@ -241,6 +242,23 @@ constexpr bool enum_contains(string_view value) noexcept;
|
|||
magic_enum::enum_contains<Color>("fda"); // -> false
|
||||
```
|
||||
|
||||
## `enum_type_name`
|
||||
|
||||
```cpp
|
||||
template <typename E>
|
||||
constexpr string_view enum_type_name() noexcept;
|
||||
```
|
||||
|
||||
* Returns `std::string_view` with null-terminated string name of enum type.
|
||||
|
||||
* Examples
|
||||
|
||||
```cpp
|
||||
Color color = Color::RED;
|
||||
auto type_name = magic_enum::enum_type_name<decltype(color)>();
|
||||
// color_name -> "Color"
|
||||
```
|
||||
|
||||
## `is_unscoped_enum`
|
||||
|
||||
```cpp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue