From Jason Turner

[range.adjacent.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmps025ypu5/{from.md → to.md} +30 -0
tmp/tmps025ypu5/{from.md → to.md} RENAMED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Overview <a id="range.adjacent.overview">[[range.adjacent.overview]]</a>
2
+
3
+ `adjacent_view` takes a view and produces a view whose Mᵗʰ element is a
4
+ tuple of references to 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::adjacent<N>` denotes a range adaptor object
9
+ [[range.adaptor.object]]. Given a subexpression `E` and a constant
10
+ expression `N`, the expression `views::adjacent<N>(E)` is
11
+ expression-equivalent to
12
+
13
+ - `((void)E, auto(views::empty<tuple<>>))` if `N` is equal to `0`,
14
+ - otherwise, `adjacent_view<views::all_t<decltype((E))>, N>(E)`.
15
+
16
+ [*Example 1*:
17
+
18
+ ``` cpp
19
+ vector v = {1, 2, 3, 4};
20
+
21
+ for (auto i : v | views::adjacent<2>) {
22
+ cout << "(" << std::get<0>(i) << ", " << std::get<1>(i) << ") "; // prints (1, 2) (2, 3) (3, 4)
23
+ }
24
+ ```
25
+
26
+ — *end example*]
27
+
28
+ Define `REPEAT(T, N)` as a pack of `N` types, each of which denotes the
29
+ same type as `T`.
30
+