From Jason Turner

[transform.exclusive.scan]

Diff to HTML by rtfpessoa

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