tmp/tmpgz710j6q/{from.md → to.md}
RENAMED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
### Exclusive scan <a id="exclusive.scan">[[exclusive.scan]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class OutputIterator, class T>
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 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
|
|
|
|
| 19 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 20 |
-
|
| 21 |
-
T init);
|
| 22 |
```
|
| 23 |
|
| 24 |
*Effects:* Equivalent to:
|
| 25 |
|
| 26 |
``` cpp
|
|
@@ -28,28 +28,35 @@ 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 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
template<class ExecutionPolicy,
|
| 37 |
class ForwardIterator1, class ForwardIterator2, class T, class BinaryOperation>
|
| 38 |
-
ForwardIterator2
|
|
|
|
| 39 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 40 |
-
|
| 41 |
-
T init, BinaryOperation binary_op);
|
| 42 |
```
|
| 43 |
|
| 44 |
-
*
|
| 45 |
|
| 46 |
-
- `
|
| 47 |
-
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
`result + (last - first)`\].
|
| 52 |
|
| 53 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 54 |
through `result + K` the value of:
|
| 55 |
|
|
@@ -63,9 +70,9 @@ GENERALIZED_NONCOMMUTATIVE_SUM(
|
|
| 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
|
| 69 |
sum. If `binary_op` is not mathematically associative, the behavior of
|
| 70 |
`exclusive_scan` may be nondeterministic. — *end note*]
|
| 71 |
|
|
|
|
| 1 |
### Exclusive scan <a id="exclusive.scan">[[exclusive.scan]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class OutputIterator, class T>
|
| 5 |
+
constexpr OutputIterator
|
| 6 |
+
exclusive_scan(InputIterator first, InputIterator last,
|
| 7 |
+
OutputIterator result, 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
|
| 19 |
+
exclusive_scan(ExecutionPolicy&& exec,
|
| 20 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 21 |
+
ForwardIterator2 result, T init);
|
|
|
|
| 22 |
```
|
| 23 |
|
| 24 |
*Effects:* Equivalent to:
|
| 25 |
|
| 26 |
``` cpp
|
|
|
|
| 28 |
first, last, result, init, plus<>());
|
| 29 |
```
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
|
| 33 |
+
constexpr OutputIterator
|
| 34 |
+
exclusive_scan(InputIterator first, InputIterator last,
|
| 35 |
+
OutputIterator result, T init, BinaryOperation binary_op);
|
| 36 |
template<class ExecutionPolicy,
|
| 37 |
class ForwardIterator1, class ForwardIterator2, class T, class BinaryOperation>
|
| 38 |
+
ForwardIterator2
|
| 39 |
+
exclusive_scan(ExecutionPolicy&& exec,
|
| 40 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 41 |
+
ForwardIterator2 result, T init, BinaryOperation binary_op);
|
|
|
|
| 42 |
```
|
| 43 |
|
| 44 |
+
*Mandates:* All of
|
| 45 |
|
| 46 |
+
- `binary_op(init, init)`,
|
| 47 |
+
- `binary_op(init, *first)`, and
|
| 48 |
+
- `binary_op(*first, *first)`
|
| 49 |
+
|
| 50 |
+
are convertible to `T`.
|
| 51 |
+
|
| 52 |
+
*Preconditions:*
|
| 53 |
+
|
| 54 |
+
- `T` meets the *Cpp17MoveConstructible* ([[cpp17.moveconstructible]])
|
| 55 |
+
requirements.
|
| 56 |
+
- `binary_op` neither invalidates iterators or subranges, nor modifies
|
| 57 |
+
elements in the ranges \[`first`, `last`\] or \[`result`,
|
| 58 |
`result + (last - first)`\].
|
| 59 |
|
| 60 |
*Effects:* For each integer `K` in \[`0`, `last - first`) assigns
|
| 61 |
through `result + K` the value of:
|
| 62 |
|
|
|
|
| 70 |
*Complexity:* 𝑂(`last - first`) applications of `binary_op`.
|
| 71 |
|
| 72 |
*Remarks:* `result` may be equal to `first`.
|
| 73 |
|
| 74 |
[*Note 1*: The difference between `exclusive_scan` and `inclusive_scan`
|
| 75 |
+
is that `exclusive_scan` excludes the iᵗʰ input element from the iᵗʰ
|
| 76 |
sum. If `binary_op` is not mathematically associative, the behavior of
|
| 77 |
`exclusive_scan` may be nondeterministic. — *end note*]
|
| 78 |
|