23 if (array[
idx] == value) {
30template <auto array, auto Offset,
typename Acc, auto ArrayOffset = 0>
31static consteval auto rangify() {
32 using underlying =
decltype(
Offset);
33 if constexpr (array.empty()) {
37 if constexpr (first == array.size()) {
40 constexpr auto last =
find_first(array.data(), first, array.size(),
false);
41 return rangify<array,
Offset,
42 typename Acc::template add_range<
53 if (std::cmp_less(value, min)) {
56 return std::cmp_less(max, value) ? max :
static_cast<T
>(value);
59#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
66 requires std::is_enum_v<T>
70 template <underlying Offset, underlying Max>
80 template <underlying Offset, underlying Max>
88 array[0] = list[0] !=
'(';
92 if (list[
idx] ==
',') {
100 template <underlying Offset, underlying Max,
typename Acc = RangeList<>, underlying N = 0>
102 if constexpr (
N ==
Max) {
105 constexpr auto index =
Offset +
N;
110 template <underlying Offset, underlying Max,
typename Acc = RangeList<>>
113 template <underlying Offset, underlying Max,
typename Acc = RangeList<>>
116 template <underlying Offset, underlying Max,
typename Acc = RangeList<>>
119 template <underlying Offset, underlying Max,
typename Acc = RangeList<>>
121#if USING(REPR_ENUM_RECURSIVE_SEARCH)
123#elif USING(REPR_ENUM_FAST_SEARCH)
129 template <auto Offset, auto Max, auto ChunkSize = REPR_ENUM_CHUNKSIZE,
typename Acc = RangeList<>, auto N = 0>
147 if constexpr (std::is_signed_v<underlying>) {
159 if constexpr (std::is_signed_v<underlying>) {
174 array[0] = list[0] !=
'(';
178 if (list[
idx] ==
',') {
184 const auto last =
std::find(array.rbegin(), array.rend(),
true);
185 if (last == array.rend()) {
201 const auto last =
std::find(result.rbegin(), result.rend(),
true);
202 if (last == result.rend()) {
212 requires std::is_unsigned_v<underlying>
218 if constexpr (
N == 0) {
234 if constexpr (linear_search::size == 0) {
237 if constexpr (std::is_unsigned_v<underlying> && linear_search::is_binary_powers()) {
239#if USING(REPR_ENUM_RECURSIVE_SEARCH)
241#elif USING(REPR_ENUM_FAST_SEARCH)
260#if USING(LIBREPR_COMPILER_CLANG) && __has_warning("-Wenum-constexpr-conversion")
265 requires std::is_enum_v<T>
Definition customization/enum.h:12
#define REPR_ENUM_MAX_UNSIGNED
Definition default.h:66
#define REPR_ENUM_MIN_SIGNED
Definition default.h:54
#define REPR_ENUM_MIN_UNSIGNED
Definition default.h:62
#define REPR_ENUM_MAX_SIGNED
Definition default.h:58
constexpr T clamp(auto value)
Definition search.h:50
decltype(Search< T >::search()) dump_enum
Definition search.h:266
EnumKind
Definition enum/util.h:13
constexpr std::size_t find_first(bool const *array, std::size_t min, std::size_t max, bool value)
Definition search.h:21
std::string code_for()
Definition repr:39
Definition customization.h:12
search_chunked< Offset, Max, Acc > do_search
Definition search.h:126
static consteval auto reflected_min()
Definition search.h:142
static consteval auto search_range()
Definition search.h:101
static consteval auto search()
Definition search.h:228
decltype(rangify< search_chunk_multi< Offset, Offset+Max >(), Offset, Acc >()) search_fast
Definition search.h:117
static consteval int largest_flag()
Definition search.h:213
static constexpr int largest_flag_chunk()
Definition search.h:195
static consteval auto reflected_max()
Definition search.h:154
decltype(rangify< search_chunk< Offset, Offset+Max >(), Offset, Acc >()) search_chunked
Definition search.h:114
decltype(search_range< Offset, Max, Acc >()) search_recursive
Definition search.h:111
static constexpr int largest_flag_multi()
Definition search.h:167
static constexpr auto search_chunk_multi()
Definition search.h:81
static constexpr auto search_chunk()
Definition search.h:71
static consteval auto search_ranges()
Definition search.h:130
#define LIBREPR_WARNING_DISABLE_CLANG(...)
Definition warning.h:24