From dd03450dffd69bce77694ad36327b64458cb7a2e Mon Sep 17 00:00:00 2001 From: neargye Date: Sun, 12 Nov 2023 18:22:08 +0400 Subject: [PATCH] fix build --- include/nameof.hpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/include/nameof.hpp b/include/nameof.hpp index a970e87..1179e42 100644 --- a/include/nameof.hpp +++ b/include/nameof.hpp @@ -573,7 +573,6 @@ constexpr auto n() noexcept { template constexpr auto enum_name() noexcept { - static_assert(is_enum_v, "nameof::detail::n requires enum type."); [[maybe_unused]] constexpr auto custom_name = customize::enum_name(V); if constexpr (custom_name.empty()) { @@ -589,8 +588,6 @@ inline constexpr auto enum_name_v = enum_name(); template constexpr bool is_valid() noexcept { - static_assert(is_enum_v, "nameof::detail::is_valid requires enum type."); - #if defined(__clang__) && __clang_major__ >= 16 // https://reviews.llvm.org/D130058, https://reviews.llvm.org/D131307 constexpr E v = __builtin_bit_cast(E, V); @@ -607,8 +604,6 @@ constexpr bool is_valid() noexcept { template > constexpr U ualue(std::size_t i) noexcept { - static_assert(is_enum_v, "nameof::detail::ualue requires enum type."); - if constexpr (std::is_same_v) { // bool special case static_assert(O == 0, "nameof::detail::ualue requires valid offset."); @@ -622,15 +617,11 @@ constexpr U ualue(std::size_t i) noexcept { template > constexpr E value(std::size_t i) noexcept { - static_assert(is_enum_v, "nameof::detail::value requires enum type."); - return static_cast(ualue(i)); } template > constexpr int reflected_min() noexcept { - static_assert(is_enum_v, "nameof::detail::reflected_min requires enum type."); - if constexpr (IsFlags) { return 0; } else { @@ -647,8 +638,6 @@ constexpr int reflected_min() noexcept { template > constexpr int reflected_max() noexcept { - static_assert(is_enum_v, "nameof::detail::reflected_max requires enum type."); - if constexpr (IsFlags) { return std::numeric_limits::digits - 1; } else { @@ -766,8 +755,6 @@ inline constexpr auto names_v = names(std::make_index_sequence> constexpr bool is_sparse() noexcept { - static_assert(is_enum_v, "nameof::detail::is_sparse requires enum type."); - if constexpr (count_v == 0) { return false; } else if constexpr (std::is_same_v) { // bool special case @@ -786,8 +773,6 @@ inline constexpr bool is_sparse_v = is_sparse(); template > [[nodiscard]] constexpr E enum_value(std::size_t i) noexcept { - static_assert(is_enum_v, "nameof::detail::enum_value requires enum type."); - if constexpr (is_sparse_v) { return values_v[i]; } else { @@ -1118,7 +1103,7 @@ template if (!name.empty()) { name.append(1, sep); } - name.append(n); + name.append(n.data(), n.size()); } else { return {}; // Value out of range. }