From Jason Turner

[range.adjacent.transform.overview]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpabyn_dcg/{from.md → to.md} +31 -0
tmp/tmpabyn_dcg/{from.md → to.md} RENAMED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Overview <a id="range.adjacent.transform.overview">[[range.adjacent.transform.overview]]</a>
2
+
3
+ `adjacent_transform_view` takes an invocable object and a view and
4
+ produces a view whose Mᵗʰ element is the result of applying the
5
+ invocable object to the Mᵗʰ through (M + N - 1)ᵗʰ elements of the
6
+ original view. If the original view has fewer than N elements, the
7
+ resulting view is empty.
8
+
9
+ The name `views::adjacent_transform<N>` denotes a range adaptor object
10
+ [[range.adaptor.object]]. Given subexpressions `E` and `F` and a
11
+ constant expression `N`:
12
+
13
+ - If `N` is equal to `0`, `views::adjacent_transform<N>(E, F)` is
14
+ expression-equivalent to `((void)E, views::zip_transform(F))`, except
15
+ that the evaluations of `E` and `F` are indeterminately sequenced.
16
+ - Otherwise, the expression `views::adjacent_transform<N>(E, F)` is
17
+ expression-equivalent to
18
+ `adjacent_transform_view<views::all_t<decltype((E))>, decay_t<decltype((F))>, N>(E, F)`.
19
+
20
+ [*Example 1*:
21
+
22
+ ``` cpp
23
+ vector v = {1, 2, 3, 4};
24
+
25
+ for (auto i : v | views::adjacent_transform<2>(std::multiplies())) {
26
+ cout << i << ' '; // prints 2 6 12
27
+ }
28
+ ```
29
+
30
+ — *end example*]
31
+