76 return value - offset > index;
95 const T current_value =
indices[i];
96 if (current_value == last_value + 1) {
98 if (current_range_size >= min_range_size) {
99 return i - min_range_size + 1;
103 current_range_size = 1;
105 last_value = current_value;
116template<
typename T,
int64_t InlineBufferSize>
123 const int64_t old_segments_num = r_segments.size();
125 while (!remaining_indices.
is_empty()) {
128 r_segments.append(*
range);
134 r_segments.append(
IndexRange(remaining_indices[0], segment_size));
135 remaining_indices = remaining_indices.
drop_front(segment_size);
142 r_segments.append(*
range);
145 r_segments.append(segment_indices);
147 remaining_indices = remaining_indices.
drop_front(segment_size);
149 return r_segments.
size() - old_segments_num;
constexpr Span drop_front(int64_t n) const
constexpr int64_t size() const
constexpr Span take_front(int64_t n) const
constexpr bool is_empty() const
static int64_t first_if(Iterator begin, Iterator end, Predicate &&predicate)
int64_t find_size_of_next_range(const Span< T > indices)
std::optional< IndexRange > non_empty_as_range_try(const Span< T > indices)
int64_t find_size_until_next_range(const Span< T > indices, const int64_t min_range_size)
int64_t split_to_ranges_and_spans(const Span< T > indices, const int64_t range_threshold, Vector< std::variant< IndexRange, Span< T > >, InlineBufferSize > &r_segments)
bool non_empty_is_range(const Span< T > indices)
IndexRange non_empty_as_range(const Span< T > indices)