40 return indices.
last() - indices.
first() == indices.
size() - 1;
76 return value - offset >
index;
90 indices, [&](
const T &value) {
return value >= range.
first(); });
93 [&](
const T &value) { return value > range.last(); });
109 int64_t current_range_size = 1;
110 int64_t last_value = indices[0];
112 const T current_value = indices[i];
113 if (current_value == last_value + 1) {
114 current_range_size++;
115 if (current_range_size >= min_range_size) {
116 return i - min_range_size + 1;
120 current_range_size = 1;
122 last_value = current_value;
124 return indices.
size();
133template<
typename T,
int64_t InlineBufferSize>
140 const int64_t old_segments_num = r_segments.size();
141 Span<T> remaining_indices = indices;
142 while (!remaining_indices.
is_empty()) {
145 r_segments.append(*range);
151 r_segments.append(
IndexRange(remaining_indices[0], segment_size));
152 remaining_indices = remaining_indices.
drop_front(segment_size);
159 r_segments.append(*range);
162 r_segments.append(segment_indices);
164 remaining_indices = remaining_indices.
drop_front(segment_size);
166 return r_segments.
size() - old_segments_num;
constexpr int64_t first() const
constexpr bool is_empty() const
static constexpr IndexRange from_begin_end(const int64_t begin, const int64_t end)
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)
IndexRange find_content_range(const Span< T > indices, const IndexRange range)
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)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)