40 return indices.
last() - indices.
first() == indices.
size() - 1;
76 return value - offset > index;
93 int64_t last_value = indices[0];
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;
107 return indices.
size();
116template<
typename T,
int64_t InlineBufferSize>
123 const int64_t old_segments_num = r_segments.size();
124 Span<T> remaining_indices = indices;
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 IndexRange()=default
constexpr IndexRange drop_front(int64_t n) const
constexpr Span drop_front(int64_t n) const
constexpr const T & first() const
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) const
constexpr IndexRange index_range() const
constexpr const T * begin() const
constexpr Span take_front(int64_t n) const
constexpr bool is_empty() const
int64_t first_if(const Range &range, 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)