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