tmp/tmpemm470iq/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Overview <a id="range.cartesian.overview">[[range.cartesian.overview]]</a>
|
| 2 |
+
|
| 3 |
+
`cartesian_product_view` takes any non-zero number of ranges n and
|
| 4 |
+
produces a view of tuples calculated by the n-ary cartesian product of
|
| 5 |
+
the provided ranges.
|
| 6 |
+
|
| 7 |
+
The name `views::cartesian_product` denotes a customization point object
|
| 8 |
+
[[customization.point.object]]. Given a pack of subexpressions `Es`, the
|
| 9 |
+
expression `views::cartesian_product(Es...)` is expression-equivalent to
|
| 10 |
+
|
| 11 |
+
- `views::single(tuple())` if `Es` is an empty pack,
|
| 12 |
+
- otherwise,
|
| 13 |
+
`cartesian_product_view<views::all_t<decltype((Es))>...>(Es...)`.
|
| 14 |
+
|
| 15 |
+
[*Example 1*:
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
vector<int> v { 0, 1, 2 };
|
| 19 |
+
for (auto&& [a, b, c] : views::cartesian_product(v, v, v)) {
|
| 20 |
+
cout << a << ' ' << b << ' ' << c << '\n';
|
| 21 |
+
}
|
| 22 |
+
// The above prints
|
| 23 |
+
// 0 0 0
|
| 24 |
+
// 0 0 1
|
| 25 |
+
// 0 0 2
|
| 26 |
+
// 0 1 0
|
| 27 |
+
// 0 1 1
|
| 28 |
+
// ...
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
— *end example*]
|
| 32 |
+
|