tmp/tmphko65qt2/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="range.zip.overview">[[range.zip.overview]]</a>
|
| 2 |
+
|
| 3 |
+
`zip_view` takes any number of views and produces a view of tuples of
|
| 4 |
+
references to the corresponding elements of the constituent views.
|
| 5 |
+
|
| 6 |
+
The name `views::zip` denotes a customization point object
|
| 7 |
+
[[customization.point.object]]. Given a pack of subexpressions `Es...`,
|
| 8 |
+
the expression `views::zip(Es...)` is expression-equivalent to
|
| 9 |
+
|
| 10 |
+
- `auto(views::empty<tuple<>>)` if `Es` is an empty pack,
|
| 11 |
+
- otherwise, `zip_view<views::all_t<decltype((Es))>...>(Es...)`.
|
| 12 |
+
|
| 13 |
+
[*Example 1*:
|
| 14 |
+
|
| 15 |
+
``` cpp
|
| 16 |
+
vector v = {1, 2};
|
| 17 |
+
list l = {'a', 'b', 'c'};
|
| 18 |
+
|
| 19 |
+
auto z = views::zip(v, l);
|
| 20 |
+
range_reference_t<decltype(z)> f = z.front(); // f is a tuple<int&, char&>
|
| 21 |
+
// that refers to the first element of v and l
|
| 22 |
+
|
| 23 |
+
for (auto&& [x, y] : z) {
|
| 24 |
+
cout << '(' << x << ", " << y << ") "; // prints (1, a) (2, b)
|
| 25 |
+
}
|
| 26 |
+
```
|
| 27 |
+
|
| 28 |
+
— *end example*]
|
| 29 |
+
|