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

add enum_reflected

This commit is contained in:
neargye 2024-06-29 16:47:56 +03:00
parent 2ac8152a2b
commit bc2e94853b
3 changed files with 55 additions and 0 deletions

View file

@ -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_reflected` returns true if the enum value is in the range of values that can be reflected..](#enum_reflected)
* [`enum_type_name` returns type name of enum.](#enum_type_name)
* [`enum_fuse` returns a bijective mix of enum values.](#enum_fuse)
* [`enum_switch` allows runtime enum value transformation to constexpr context.](#enum_switch)
@ -316,6 +317,21 @@ constexpr bool enum_contains(string_view value, BinaryPredicate p) noexcept(is_n
magic_enum::enum_contains<Color>("fda"); // -> false
```
## `enum_reflected`
```cpp
template <typename E>
constexpr bool enum_contains(E value) noexcept;
template <typename E>
constexpr bool enum_contains(underlying_type_t<E> value) noexcept;
template <typename E>
constexpr bool enum_contains(string_view value) noexcept;
```
* Returns true if the enum value is in the range of values that can be reflected.
## `enum_type_name`
```cpp