From Jason Turner

[exclusive.scan]

Diff to HTML by rtfpessoa

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