diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index 5dfb4cc..c89be3b 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -431,23 +431,18 @@ constexpr auto n() noexcept { template inline constexpr auto enum_name_v = n(); -#if defined(__clang__) || defined(__GNUC__) -template -struct is_valid : std::false_type {}; - -template -struct is_valid(V)>())>> : std::bool_constant<(n(V)>().size() != 0)> {}; -#else -template +template constexpr bool valid() noexcept { static_assert(is_enum_v, "magic_enum::detail::is_valid requires enum type."); return n(V)>().size() != 0; } +template +struct is_valid : std::false_type {}; + template -struct is_valid : std::bool_constant(V)>()> {}; -#endif +struct is_valid(V)>())>> : std::bool_constant(V)>()> {}; template > constexpr U ualue(std::size_t i) noexcept {