diff --git a/include/nameof.hpp b/include/nameof.hpp index 78462f2..38c0d27 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -579,10 +579,8 @@ template // Obtains simple (unqualified) string enum name of static storage enum variable. // This version is much lighter on the compile times and is not restricted to the enum_range limitation. template -[[nodiscard]] constexpr auto nameof_enum() noexcept { - using D = detail::remove_cvref_t; - static_assert(std::is_enum_v, "nameof::nameof_enum requires enum type."); - constexpr auto name = detail::n(); +[[nodiscard]] constexpr auto nameof_enum() noexcept -> detail::enable_if_enum_t { + constexpr std::string_view name = detail::enum_name_v, V>; static_assert(name.size() > 0, "Enum value does not have a name."); return name;