mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
removed restrictions on maximum range size
This commit is contained in:
parent
d7c7675b56
commit
ec11ae0c28
1 changed files with 0 additions and 4 deletions
|
|
@ -166,14 +166,11 @@ namespace customize {
|
||||||
// If need another range for specific enum type, add specialization enum_range for necessary enum type.
|
// If need another range for specific enum type, add specialization enum_range for necessary enum type.
|
||||||
template <typename E>
|
template <typename E>
|
||||||
struct enum_range {
|
struct enum_range {
|
||||||
static_assert(std::is_enum_v<E>, "magic_enum::customize::enum_range requires enum type.");
|
|
||||||
static constexpr int min = MAGIC_ENUM_RANGE_MIN;
|
static constexpr int min = MAGIC_ENUM_RANGE_MIN;
|
||||||
static constexpr int max = MAGIC_ENUM_RANGE_MAX;
|
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, "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<std::uint16_t>::max)(), "MAGIC_ENUM_RANGE must be less than UINT16_MAX.");
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
|
@ -772,7 +769,6 @@ constexpr auto values() noexcept {
|
||||||
constexpr auto max = reflected_max<E, S>();
|
constexpr auto max = reflected_max<E, S>();
|
||||||
constexpr auto range_size = max - min + 1;
|
constexpr auto range_size = max - min + 1;
|
||||||
static_assert(range_size > 0, "magic_enum::enum_range requires valid size.");
|
static_assert(range_size > 0, "magic_enum::enum_range requires valid size.");
|
||||||
static_assert(range_size < (std::numeric_limits<std::uint16_t>::max)(), "magic_enum::enum_range requires valid size.");
|
|
||||||
|
|
||||||
return values<E, S, range_size, min>();
|
return values<E, S, range_size, min>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue