diff --git a/doc/reference.md b/doc/reference.md index 30c0e26..6759e3c 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -371,11 +371,32 @@ template ## `enum_switch` -TODO +```cpp +template +constexpr Result enum_switch(Lambda&& lambda, E value); + +template +constexpr Result enum_switch(Lambda&& lambda, E value, Result&& result); + +template , typename Lambda> +constexpr Result enum_switch(Lambda&& lambda, string_view name, BinaryPredicate&& p = {}); + +template , typename Lambda> +constexpr Result enum_switch(Lambda&& lambda, string_view name, Result&& result, BinaryPredicate&& p = {}); + +template +constexpr Result enum_switch(Lambda&& lambda, underlying_type_t value); + +template +constexpr Result enum_switch(Lambda&& lambda, underlying_type_t value, Result&& result); +``` ## `enum_for_each` -TODO +```cpp +template +constexpr auto enum_for_each(Lambda&& lambda); +``` ## `is_unscoped_enum` diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 08de1dd..8b6712d 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -990,7 +990,7 @@ template // Returns underlying value from enum value. template -[[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_enum_t> { +[[nodiscard]] constexpr auto enum_underlying(E value) noexcept -> detail::enable_if_t> { return static_cast>(value); }