diff --git a/include/magic_enum.hpp b/include/magic_enum.hpp index e7e3f62..e791875 100644 --- a/include/magic_enum.hpp +++ b/include/magic_enum.hpp @@ -897,9 +897,6 @@ constexpr auto for_each(Lambda&& lambda, std::index_sequence) { } } -template > -using for_each_t = decltype(for_each(std::declval(), std::make_index_sequence>{})); - } // namespace magic_enum::detail // Checks is magic_enum supported compiler. @@ -1274,8 +1271,9 @@ constexpr auto enum_switch(Lambda&& lambda, underlying_type_t value, Result&& } template -constexpr auto enum_for_each(Lambda&& lambda) -> detail::enable_if_t> { +constexpr auto enum_for_each(Lambda&& lambda) { using D = std::decay_t; + static_assert(std::is_enum_v, "magic_enum::enum_for_each requires enum type."); return detail::for_each(std::forward(lambda), std::make_index_sequence>{}); }