diff --git a/include/nameof.hpp b/include/nameof.hpp index 6fef869..3ed5fb8 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -195,7 +195,7 @@ template template [[nodiscard]] constexpr decltype(auto) enum_strings_impl(std::integer_sequence) noexcept { - static_assert(std::is_enum_v, "magic_enum::detail::enum_strings_impl requires enum type."); + static_assert(std::is_enum_v, "nameof::detail::enum_strings_impl requires enum type."); constexpr std::array enum_names{{enum_name_impl(I + O)>()...}}; return enum_names; @@ -203,9 +203,10 @@ template template > [[nodiscard]] constexpr std::string_view nameof_enum_impl(int value) noexcept { - static_assert(std::is_enum_v, "magic_enum::detail::nameof_enum_impl requires enum type."); - constexpr int max = (enum_range::max < std::numeric_limits::max()) ? enum_range::max : std::numeric_limits::max(); - constexpr int min = (enum_range::min > std::numeric_limits::min()) ? enum_range::min : std::numeric_limits::min(); + static_assert(std::is_enum_v, "nameof::detail::nameof_enum_impl requires enum type."); + static_assert(enum_range::max > enum_range::min, "nameof::enum_range requires max > min."); + constexpr int max = enum_range::max < (std::numeric_limits::max)() ? enum_range::max : (std::numeric_limits::max)(); + constexpr int min = enum_range::min > (std::numeric_limits::min)() ? enum_range::min : (std::numeric_limits::min)(); constexpr auto enum_range = std::make_integer_sequence{}; constexpr auto enum_names = enum_strings_impl(enum_range); const int i = value - min; @@ -230,8 +231,8 @@ template } // namespace detail // Obtains simple (unqualified) string enum name of enum variable. -template , typename = std::enable_if_t>> -[[nodiscard]] constexpr std::string_view nameof_enum(T value) noexcept { +template , typename = std::enable_if_t>> +[[nodiscard]] constexpr std::string_view nameof_enum(E value) noexcept { static_assert(std::is_enum_v, "nameof::nameof_enum requires enum type."); return detail::nameof_enum_impl(static_cast(value));