tmp/tmp4es0hufm/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="range.slide.overview">[[range.slide.overview]]</a>
|
| 2 |
+
|
| 3 |
+
`slide_view` takes a view and a number N and produces a view whose Mᵗʰ
|
| 4 |
+
element is a view over the Mᵗʰ through (M + N - 1)ᵗʰ elements of the
|
| 5 |
+
original view. If the original view has fewer than N elements, the
|
| 6 |
+
resulting view is empty.
|
| 7 |
+
|
| 8 |
+
The name `views::slide` denotes a range adaptor object
|
| 9 |
+
[[range.adaptor.object]]. Given subexpressions `E` and `N`, the
|
| 10 |
+
expression `views::slide(E, N)` is expression-equivalent to
|
| 11 |
+
`slide_view(E, N)`.
|
| 12 |
+
|
| 13 |
+
[*Example 1*:
|
| 14 |
+
|
| 15 |
+
``` cpp
|
| 16 |
+
vector v = {1, 2, 3, 4};
|
| 17 |
+
|
| 18 |
+
for (auto i : v | views::slide(2)) {
|
| 19 |
+
cout << '[' << i[0] << ", " << i[1] << "] "; // prints [1, 2] [2, 3] [3, 4]
|
| 20 |
+
}
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
— *end example*]
|
| 24 |
+
|