From Jason Turner

[range.chunk.by.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpyfvrk_ly/{from.md → to.md} +30 -0
tmp/tmpyfvrk_ly/{from.md → to.md} RENAMED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Overview <a id="range.chunk.by.overview">[[range.chunk.by.overview]]</a>
2
+
3
+ `chunk_by_view` takes a view and a predicate, and splits the view into
4
+ `subrange`s between each pair of adjacent elements for which the
5
+ predicate returns `false`.
6
+
7
+ The name `views::chunk_by` denotes a range adaptor object
8
+ [[range.adaptor.object]]. Given subexpressions `E` and `F`, the
9
+ expression `views::chunk_by(E, F)` is expression-equivalent to
10
+ `chunk_by_view(E, F)`.
11
+
12
+ [*Example 1*:
13
+
14
+ ``` cpp
15
+ vector v = {1, 2, 2, 3, 0, 4, 5, 2};
16
+
17
+ for (auto r : v | views::chunk_by(ranges::less_equal{})) {
18
+ cout << '[';
19
+ auto sep = "";
20
+ for (auto i : r) {
21
+ cout << sep << i;
22
+ sep = ", ";
23
+ }
24
+ cout << "] ";
25
+ }
26
+ // The above prints [1, 2, 2, 3] [0, 4, 5] [2]
27
+ ```
28
+
29
+ — *end example*]
30
+