[range.chunk.by.overview]

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

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

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

#### 25.7.31.1 Overview [range.chunk.by.overview]

[1](#1)

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

chunk_by_view takes a view and a predicate, and
splits the view into subranges
between each pair of adjacent elements
for which the predicate returns false[.](#1.sentence-1)

[2](#2)

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

The name views​::​chunk_by denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2 Range adaptor objects"))[.](#2.sentence-1)

Given subexpressions E and F,
the expression views​::​chunk_by(E, F) is expression-equivalent tochunk_by_view(E, F)[.](#2.sentence-2)

[*Example [1](#example-1)*: vector v = {1, 2, 2, 3, 0, 4, 5, 2};

for (auto r : v | views::chunk_by(ranges::less_equal{})) { cout << '['; auto sep = ""; for (auto i : r) { cout << sep << i;
 sep = ", "; } cout << "] ";}// The above prints [1, 2, 2, 3] [0, 4, 5] [2] â *end example*]
