tmp/tmpwmkii0gl/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="range.chunk.overview">[[range.chunk.overview]]</a>
|
| 2 |
+
|
| 3 |
+
`chunk_view` takes a view and a number N and produces a range of views
|
| 4 |
+
that are N-sized non-overlapping successive chunks of the elements of
|
| 5 |
+
the original view, in order. The last view in the range can have fewer
|
| 6 |
+
than N elements.
|
| 7 |
+
|
| 8 |
+
The name `views::chunk` denotes a range adaptor object
|
| 9 |
+
[[range.adaptor.object]]. Given subexpressions `E` and `N`, the
|
| 10 |
+
expression `views::chunk(E, N)` is expression-equivalent to
|
| 11 |
+
`chunk_view(E, N)`.
|
| 12 |
+
|
| 13 |
+
[*Example 1*:
|
| 14 |
+
|
| 15 |
+
``` cpp
|
| 16 |
+
vector v = {1, 2, 3, 4, 5};
|
| 17 |
+
|
| 18 |
+
for (auto r : v | views::chunk(2)) {
|
| 19 |
+
cout << '[';
|
| 20 |
+
auto sep = "";
|
| 21 |
+
for (auto i : r) {
|
| 22 |
+
cout << sep << i;
|
| 23 |
+
sep = ", ";
|
| 24 |
+
}
|
| 25 |
+
cout << "] ";
|
| 26 |
+
}
|
| 27 |
+
// The above prints [1, 2] [3, 4] [5]
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
— *end example*]
|
| 31 |
+
|