From ec11ae0c285773e691a1e8372e4984189a6bed1e Mon Sep 17 00:00:00 2001 From: neargye Date: Thu, 22 Feb 2024 14:23:33 +0400 Subject: [PATCH] removed restrictions on maximum range size --- include/magic_enum/magic_enum.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/magic_enum/magic_enum.hpp b/include/magic_enum/magic_enum.hpp index 5de2657dd..7adf87715 100644 --- a/include/magic_enum/magic_enum.hpp +++ b/include/magic_enum/magic_enum.hpp @@ -166,14 +166,11 @@ namespace customize { // If need another range for specific enum type, add specialization enum_range for necessary enum type. template struct enum_range { - static_assert(std::is_enum_v, "magic_enum::customize::enum_range requires enum type."); static constexpr int min = MAGIC_ENUM_RANGE_MIN; static constexpr int max = MAGIC_ENUM_RANGE_MAX; - static_assert(max > min, "magic_enum::customize::enum_range requires max > min."); }; static_assert(MAGIC_ENUM_RANGE_MAX > MAGIC_ENUM_RANGE_MIN, "MAGIC_ENUM_RANGE_MAX must be greater than MAGIC_ENUM_RANGE_MIN."); -static_assert((MAGIC_ENUM_RANGE_MAX - MAGIC_ENUM_RANGE_MIN) < (std::numeric_limits::max)(), "MAGIC_ENUM_RANGE must be less than UINT16_MAX."); namespace detail { @@ -772,7 +769,6 @@ constexpr auto values() noexcept { constexpr auto max = reflected_max(); constexpr auto range_size = max - min + 1; static_assert(range_size > 0, "magic_enum::enum_range requires valid size."); - static_assert(range_size < (std::numeric_limits::max)(), "magic_enum::enum_range requires valid size."); return values(); }