From 48ffc2f8553676675b72fae65e3d9b96db813397 Mon Sep 17 00:00:00 2001 From: neargye Date: Fri, 13 Sep 2019 19:45:01 +0500 Subject: [PATCH] using nodiscard only where it's need --- include/nameof.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index a95b1cd..1eec9a6 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -214,7 +214,7 @@ template } template -[[nodiscard]] constexpr auto n() noexcept { +constexpr auto n() noexcept { static_assert(std::is_enum_v, "nameof::detail::nameof_enum requires enum type."); #if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 9 constexpr auto name = nameof({__PRETTY_FUNCTION__, sizeof(__PRETTY_FUNCTION__) - 2}); @@ -234,14 +234,14 @@ template inline constexpr auto nameof_enum_v = n(); template -[[nodiscard]] constexpr auto enum_names(std::integer_sequence) noexcept { +constexpr auto enum_names(std::integer_sequence) noexcept { static_assert(std::is_enum_v, "nameof::detail::enum_names requires enum type."); return std::array{{nameof_enum_v(I + O)>...}}; } template -[[nodiscard]] constexpr auto n() noexcept { +constexpr auto n() noexcept { #if defined(__clang__) constexpr std::string_view name{__PRETTY_FUNCTION__ + 31, sizeof(__PRETTY_FUNCTION__) - 34}; #elif defined(__GNUC__)