@@ -84,7 +84,9 @@ consteval auto get_range_min() {
84
84
if constexpr (_is_flag) {
85
85
return 0 ;
86
86
} else {
87
- return std::max (std::numeric_limits<U>::min (), range_min<T>::value);
87
+ return std::max (static_cast <decltype (range_min<T>::value)>(
88
+ std::numeric_limits<U>::min ()),
89
+ range_min<T>::value);
88
90
}
89
91
}
90
92
template <class T , bool _is_flag>
@@ -97,7 +99,9 @@ consteval auto get_range_max() {
97
99
return (sizeof (U) * 8 - 1 );
98
100
}
99
101
} else {
100
- return std::min (std::numeric_limits<U>::max (), range_max<T>::value);
102
+ return std::min (static_cast <decltype (range_max<T>::value)>(
103
+ std::numeric_limits<U>::max ()),
104
+ range_max<T>::value);
101
105
}
102
106
}
103
107
@@ -126,7 +130,8 @@ consteval auto operator|(Names<EnumType, LiteralType, N, _is_flag, _enums...>,
126
130
}
127
131
}
128
132
129
- template <class EnumType , class LiteralType , size_t N, bool _is_flag, auto ... _enums>
133
+ template <class EnumType , class LiteralType , size_t N, bool _is_flag,
134
+ auto ... _enums>
130
135
struct NamesCombiner {
131
136
template <int ... Is>
132
137
static consteval auto combine (std::integer_sequence<int , Is...>) {
@@ -145,8 +150,10 @@ struct CombineNames {
145
150
}(std::make_integer_sequence<int , End - Start + 1 >{});
146
151
} else {
147
152
constexpr int Mid = Start + (End - Start) / 2 ;
148
- constexpr auto left = CombineNames<ChunkSize>::template apply<NamesType, Start, Mid>();
149
- constexpr auto right = CombineNames<ChunkSize>::template apply<NamesType, Mid + 1 , End>();
153
+ constexpr auto left =
154
+ CombineNames<ChunkSize>::template apply<NamesType, Start, Mid>();
155
+ constexpr auto right =
156
+ CombineNames<ChunkSize>::template apply<NamesType, Mid + 1 , End>();
150
157
return left | right;
151
158
}
152
159
}
@@ -155,16 +162,18 @@ struct CombineNames {
155
162
template <class EnumType , bool _is_flag>
156
163
consteval auto get_enum_names () {
157
164
static_assert (is_scoped_enum<EnumType>,
158
- " You must use scoped enums (using class or struct) for the parsing to work!" );
165
+ " You must use scoped enums (using class or struct) for the "
166
+ " parsing to work!" );
159
167
static_assert (std::is_integral_v<std::underlying_type_t <EnumType>>,
160
- " The underlying type of any Enum must be integral!" );
168
+ " The underlying type of any Enum must be integral!" );
161
169
162
170
constexpr auto max = get_range_max<EnumType, _is_flag>();
163
171
constexpr auto min = get_range_min<EnumType, _is_flag>();
164
172
constexpr auto range_size = max - min + 1 ;
165
173
166
174
static_assert (range_size > 0 ,
167
- " enum_range requires a valid range size. Ensure that max is greater than min." );
175
+ " enum_range requires a valid range size. Ensure that max is "
176
+ " greater than min." );
168
177
169
178
using EmptyNames = Names<EnumType, rfl::Literal<" " >, 0 , _is_flag>;
170
179
0 commit comments