From 46ffb720ad65e9cc7c1a7fc6a342ce613d1092a5 Mon Sep 17 00:00:00 2001 From: terik23 Date: Tue, 2 Apr 2019 00:29:11 +0500 Subject: [PATCH] fix nameof_enum_impl --- include/nameof.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index 33cd9a8..03ec88f 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -164,9 +164,9 @@ template #endif } -template +template [[nodiscard]] constexpr std::string_view nameof_enum_impl() noexcept { - static_assert(std::is_enum_v, "nameof::nameof_enum require enum type."); + static_assert(std::is_enum_v, "nameof::nameof_enum require enum type."); #if defined(__clang__) std::string_view name{__PRETTY_FUNCTION__}; constexpr auto suffix = sizeof("]") - 1; @@ -196,21 +196,21 @@ struct nameof_enum_impl_t final { switch (value - V) { case 0: - return nameof_enum_impl(V)>(); + return nameof_enum_impl(V)>(); case 1: - return nameof_enum_impl(V + 1)>(); + return nameof_enum_impl(V + 1)>(); case 2: - return nameof_enum_impl(V + 2)>(); + return nameof_enum_impl(V + 2)>(); case 3: - return nameof_enum_impl(V + 3)>(); + return nameof_enum_impl(V + 3)>(); case 4: - return nameof_enum_impl(V + 4)>(); + return nameof_enum_impl(V + 4)>(); case 5: - return nameof_enum_impl(V + 5)>(); + return nameof_enum_impl(V + 5)>(); case 6: - return nameof_enum_impl(V + 6)>(); + return nameof_enum_impl(V + 6)>(); case 7: - return nameof_enum_impl(V + 7)>(); + return nameof_enum_impl(V + 7)>(); default: return nameof_enum_impl_t{}(value); } @@ -250,7 +250,7 @@ template // nameof_enum() used to obtain the simple (unqualified) string enum name of static storage enum variable. template >>> [[nodiscard]] constexpr std::string_view nameof_enum() noexcept { - return detail::nameof_enum_impl(); + return detail::nameof_enum_impl(); } // nameof_type() used to obtain the string name of type.