From Jason Turner

[transform.inclusive.scan]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqyavkdsp/{from.md → to.md} +80 -0
tmp/tmpqyavkdsp/{from.md → to.md} RENAMED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Transform inclusive scan <a id="transform.inclusive.scan">[[transform.inclusive.scan]]</a>
2
+
3
+ ``` cpp
4
+ template<class InputIterator, class OutputIterator,
5
+ class BinaryOperation, class UnaryOperation>
6
+ OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
7
+ OutputIterator result,
8
+ BinaryOperation binary_op,
9
+ UnaryOperation unary_op);
10
+ template<class ExecutionPolicy,
11
+ class ForwardIterator1, class ForwardIterator2,
12
+ class BinaryOperation, class UnaryOperation>
13
+ ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
14
+ ForwardIterator1 first, ForwardIterator1 last,
15
+ ForwardIterator2 result,
16
+ BinaryOperation binary_op,
17
+ UnaryOperation unary_op);
18
+ template<class InputIterator, class OutputIterator,
19
+ class BinaryOperation, class UnaryOperation, class T>
20
+ OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
21
+ OutputIterator result,
22
+ BinaryOperation binary_op,
23
+ UnaryOperation unary_op,
24
+ T init);
25
+ template<class ExecutionPolicy,
26
+ class ForwardIterator1, class ForwardIterator2,
27
+ class BinaryOperation, class UnaryOperation, class T>
28
+ ForwardIterator2 transform_inclusive_scan(ExecutionPolicy&& exec,
29
+ ForwardIterator1 first, ForwardIterator1 last,
30
+ ForwardIterator2 result,
31
+ BinaryOperation binary_op,
32
+ UnaryOperation unary_op,
33
+ T init);
34
+ ```
35
+
36
+ *Requires:*
37
+
38
+ - If `init` is provided, `T` shall be `MoveConstructible`
39
+ (Table  [[tab:moveconstructible]]); otherwise, `ForwardIterator1`’s
40
+ value type shall be `MoveConstructible`.
41
+ - If `init` is provided, all of
42
+ - `binary_op(init, init)`,
43
+ - `binary_op(init, unary_op(*first))`, and
44
+ - `binary_op(unary_op(*first), unary_op(*first))`
45
+
46
+ shall be convertible to `T`; otherwise,
47
+ `binary_op(unary_op(*first), unary_op(*first))` shall be convertible
48
+ to `ForwardIterator1`’s value type.
49
+ - Neither `unary_op` nor `binary_op` shall invalidate iterators or
50
+ subranges, nor modify elements in the ranges \[`first`, `last`\] or
51
+ \[`result`, `result + (last - first)`\].
52
+
53
+ *Effects:* For each integer `K` in \[`0`, `last - first`) assigns
54
+ through `result + K` the value of
55
+
56
+ - *GENERALIZED_NONCOMMUTATIVE_SUM*(
57
+     binary_op, init,
58
+     unary_op(\*(first + 0)), unary_op(\*(first + 1)), ...,
59
+ unary_op(\*(first + K)))
60
+ if `init` is provided, or
61
+ - *GENERALIZED_NONCOMMUTATIVE_SUM*(
62
+     binary_op,
63
+     unary_op(\*(first + 0)), unary_op(\*(first + 1)), ...,
64
+ unary_op(\*(first + K)))
65
+ otherwise.
66
+
67
+ *Returns:* The end of the resulting range beginning at `result`.
68
+
69
+ *Complexity:* 𝑂(`last - first`) applications each of `unary_op` and
70
+ `binary_op`.
71
+
72
+ *Remarks:* `result` may be equal to `first`.
73
+
74
+ [*Note 1*: The difference between `transform_exclusive_scan` and
75
+ `transform_inclusive_scan` is that `transform_inclusive_scan` includes
76
+ the iᵗʰ input element in the iᵗʰ sum. If `binary_op` is not
77
+ mathematically associative, the behavior of `transform_inclusive_scan`
78
+ may be nondeterministic. `transform_inclusive_scan` does not apply
79
+ `unary_op` to `init`. — *end note*]
80
+