From cf40c8889598a2389b4894e1ee5595dd086f53a2 Mon Sep 17 00:00:00 2001 From: terik23 Date: Tue, 23 Apr 2019 18:10:21 +0500 Subject: [PATCH] fix nameof_enum --- include/nameof.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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{};