mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
clen-up & improve (#173)
This commit is contained in:
parent
2e7313d3f7
commit
2615fa5e7b
2 changed files with 24 additions and 3 deletions
|
|
@ -371,11 +371,32 @@ template <typename... Es>
|
||||||
|
|
||||||
## `enum_switch`
|
## `enum_switch`
|
||||||
|
|
||||||
TODO
|
```cpp
|
||||||
|
template <typename Result = void, typename E, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, E value);
|
||||||
|
|
||||||
|
template <typename Result, typename E, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, E value, Result&& result);
|
||||||
|
|
||||||
|
template <typename E, typename Result = void, typename BinaryPredicate = std::equal_to<>, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, string_view name, BinaryPredicate&& p = {});
|
||||||
|
|
||||||
|
template <typename E, typename Result, typename BinaryPredicate = std::equal_to<>, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, string_view name, Result&& result, BinaryPredicate&& p = {});
|
||||||
|
|
||||||
|
template <typename E, typename Result = void, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, underlying_type_t<E> value);
|
||||||
|
|
||||||
|
template <typename E, typename Result, typename Lambda>
|
||||||
|
constexpr Result enum_switch(Lambda&& lambda, underlying_type_t<E> value, Result&& result);
|
||||||
|
```
|
||||||
|
|
||||||
## `enum_for_each`
|
## `enum_for_each`
|
||||||
|
|
||||||
TODO
|
```cpp
|
||||||
|
template <typename E, typename Lambda>
|
||||||
|
constexpr auto enum_for_each(Lambda&& lambda);
|
||||||
|
```
|
||||||
|
|
||||||
## `is_unscoped_enum`
|
## `is_unscoped_enum`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -990,7 +990,7 @@ template <typename E>
|
||||||
|
|
||||||
// Returns underlying value from enum value.
|
// Returns underlying value from enum value.
|
||||||
template <typename E>
|
template <typename E>
|
||||||
[[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_enum_t<E, underlying_type_t<E>> {
|
[[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_t<E, underlying_type_t<E>> {
|
||||||
return static_cast<underlying_type_t<E>>(value);
|
return static_cast<underlying_type_t<E>>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue