26 Ranges library [ranges]

26.7 Range adaptors [range.adaptors]

26.7.26 Chunk by view [range.chunk.by]

26.7.26.3 Class chunk_­by_­view​::​iterator [range.chunk.by.iter]

namespace std::ranges { template<forward_­range V, indirect_­binary_­predicate<iterator_t<V>, iterator_t<V>> Pred> requires view<V> && is_object_v<Pred> class chunk_by_view<V, Pred>::iterator { chunk_by_view* parent_ = nullptr; // exposition only iterator_t<V> current_ = iterator_t<V>(); // exposition only iterator_t<V> next_ = iterator_t<V>(); // exposition only constexpr iterator(chunk_by_view& parent, iterator_t<V> current, // exposition only iterator_t<V> next); public: using value_type = subrange<iterator_t<V>>; using difference_type = range_difference_t<V>; using iterator_category = input_iterator_tag; using iterator_concept = see below; iterator() = default; constexpr value_type operator*() const; constexpr iterator& operator++(); constexpr iterator operator++(int); constexpr iterator& operator--() requires bidirectional_­range<V>; constexpr iterator operator--(int) requires bidirectional_­range<V>; friend constexpr bool operator==(const iterator& x, const iterator& y); friend constexpr bool operator==(const iterator& x, default_sentinel_t); }; }
iterator​::​iterator_­concept is defined as follows:
  • If V models bidirectional_­range, then iterator_­concept denotes bidirectional_­iterator_­tag.
  • Otherwise, iterator_­concept denotes forward_­iterator_­tag.
constexpr iterator(chunk_by_view& parent, iterator_t<V> current, iterator_t<V> next);
Effects: Initializes parent_­ with addressof(parent), current_­ with current, and next_­ with next.
constexpr value_type operator*() const;
Preconditions: current_­ is not equal to next_­.
Returns: subrange(current_­, next_­).
constexpr iterator& operator++();
Preconditions: current_­ is not equal to next_­.
Effects: Equivalent to: current_ = next_; next_ = parent_->find-next(current_); return *this;
constexpr iterator operator++(int);
Effects: Equivalent to: auto tmp = *this; ++*this; return tmp;
constexpr iterator& operator--() requires bidirectional_­range<V>;
Effects: Equivalent to: next_ = current_; current_ = parent_->find-prev(next_); return *this;
constexpr iterator operator--(int) requires bidirectional_­range<V>;
Effects: Equivalent to: auto tmp = *this; --*this; return tmp;
friend constexpr bool operator==(const iterator& x, const iterator& y);
Returns: x.current_­ == y.current_­.
friend constexpr bool operator==(const iterator& x, default_sentinel_t);
Returns: x.current_­ == x.next_­.