[range.chunk.by.iter]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.chunk.by.iter)

### 25.7.31 Chunk by view [[range.chunk.by]](range.chunk.by#iter)

#### 25.7.31.3 Class chunk_by_view​::​*iterator* [range.chunk.by.iter]

[ð](#lib:chunk_by_view::iterator)

namespace std::ranges {template<[forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]") V, [indirect_binary_predicate](indirectcallable.indirectinvocable#concept:indirect_binary_predicate "24.3.6.3 Indirect callables [indirectcallable.indirectinvocable]")<iterator_t<V>, iterator_t<V>> Pred>requires [view](range.view#concept:view "25.4.5 Views [range.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](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<V>; constexpr *iterator* operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<V>; friend constexpr bool operator==(const *iterator*& x, const *iterator*& y); friend constexpr bool operator==(const *iterator*& x, default_sentinel_t); };}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15794)

*iterator*​::​iterator_concept is defined as follows:

- [(1.1)](#1.1)

  If V models [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]"),
then iterator_concept denotes bidirectional_iterator_tag[.](#1.1.sentence-1)

- [(1.2)](#1.2)

  Otherwise, iterator_concept denotes forward_iterator_tag[.](#1.2.sentence-1)

[ð](#lib:chunk_by_view::iterator,constructor)

`constexpr iterator(chunk_by_view& parent, iterator_t<V> current, iterator_t<V> next);
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15810)

*Effects*: Initializes *parent_* with addressof(parent),*current_* with current, and*next_* with next[.](#2.sentence-1)

[ð](#lib:operator*,chunk_by_view::iterator)

`constexpr value_type operator*() const;
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15823)

*Preconditions*: *current_* is not equal to *next_*[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15827)

*Returns*: subrange(*current_*, *next_*)[.](#4.sentence-1)

[ð](#lib:operator++,chunk_by_view::iterator)

`constexpr iterator& operator++();
`

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15838)

*Preconditions*: *current_* is not equal to *next_*[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15842)

*Effects*: Equivalent to:*current_* = *next_*;*next_* = *parent_*->*find-next*(*current_*);return *this;

[ð](#lib:operator++,chunk_by_view::iterator_)

`constexpr iterator operator++(int);
`

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15858)

*Effects*: Equivalent to:auto tmp = *this;++*this;return tmp;

[ð](#lib:operator--,chunk_by_view::iterator)

`constexpr iterator& operator--() requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<V>;
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15874)

*Effects*: Equivalent to:*next_* = *current_*;*current_* = *parent_*->*find-prev*(*next_*);return *this;

[ð](#lib:operator--,chunk_by_view::iterator_)

`constexpr iterator operator--(int) requires [bidirectional_range](range.refinements#concept:bidirectional_range "25.4.6 Other range refinements [range.refinements]")<V>;
`

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15890)

*Effects*: Equivalent to:auto tmp = *this;--*this;return tmp;

[ð](#lib:operator==,chunk_by_view::iterator)

`friend constexpr bool operator==(const iterator& x, const iterator& y);
`

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15906)

*Returns*: x.*current_* == y.*current_*[.](#10.sentence-1)

[ð](#lib:operator==,chunk_by_view::iterator_)

`friend constexpr bool operator==(const iterator& x, default_sentinel_t);
`

[11](#11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L15917)

*Returns*: x.*current_* == x.*next_*[.](#11.sentence-1)
