diff --git a/include/nameof.hpp b/include/nameof.hpp index 63202a5..79e56cc 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -222,10 +222,12 @@ template } // namespace nameof::detail // Obtains simple (unqualified) string enum name of enum variable. -template , typename U = std::underlying_type_t, typename = std::enable_if_t>> +template >>> [[nodiscard]] constexpr std::string_view nameof_enum(E value) noexcept { + using D = std::decay_t; static_assert(std::is_enum_v, "nameof::nameof_enum requires enum type."); static_assert(enum_range::max > enum_range::min, "nameof::enum_range requires max > min."); + using U = std::underlying_type_t; 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 range = std::make_integer_sequence{};