tmp/tmpp2ubb4aw/{from.md → to.md}
RENAMED
|
@@ -1,37 +1,73 @@
|
|
| 1 |
### Adjacent difference <a id="adjacent.difference">[[adjacent.difference]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class InputIterator, class OutputIterator>
|
| 5 |
-
OutputIterator
|
| 6 |
-
InputIterator first, InputIterator last,
|
| 7 |
OutputIterator result);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
| 9 |
-
OutputIterator
|
| 10 |
-
InputIterator first, InputIterator last,
|
| 11 |
OutputIterator result,
|
| 12 |
BinaryOperation binary_op);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
```
|
| 14 |
|
| 15 |
-
*
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
`InputIterator`’s value type, initializes it with `*i`, computes
|
| 20 |
`val - acc` or `binary_op(val, acc)`, assigns the result to
|
| 21 |
`*(result + (i - first))`, and move assigns from `val` to `acc`.
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
`*first`
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
`
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
*Remarks:* `result` may be equal to `first`.
|
| 32 |
|
| 33 |
*Returns:* `result + (last - first)`.
|
| 34 |
|
| 35 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
| 36 |
operation.
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
### Adjacent difference <a id="adjacent.difference">[[adjacent.difference]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template <class InputIterator, class OutputIterator>
|
| 5 |
+
OutputIterator
|
| 6 |
+
adjacent_difference(InputIterator first, InputIterator last,
|
| 7 |
OutputIterator result);
|
| 8 |
+
template <class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
|
| 9 |
+
ForwardIterator2
|
| 10 |
+
adjacent_difference(ExecutionPolicy&& exec,
|
| 11 |
+
ForwardIterator1 first, ForwardIterator1 last,
|
| 12 |
+
ForwardIterator2 result);
|
| 13 |
+
|
| 14 |
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
| 15 |
+
OutputIterator
|
| 16 |
+
adjacent_difference(InputIterator first, InputIterator last,
|
| 17 |
OutputIterator result,
|
| 18 |
BinaryOperation binary_op);
|
| 19 |
+
template <class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 20 |
+
class BinaryOperation>
|
| 21 |
+
ForwardIterator2
|
| 22 |
+
adjacent_difference(ExecutionPolicy&& exec,
|
| 23 |
+
ForwardIterator1 first, ForwardIterator1 last,
|
| 24 |
+
ForwardIterator2 result,
|
| 25 |
+
BinaryOperation binary_op);
|
| 26 |
```
|
| 27 |
|
| 28 |
+
*Requires:*
|
| 29 |
+
|
| 30 |
+
- For the overloads with no `ExecutionPolicy`, `InputIterator`’s value
|
| 31 |
+
type shall be `MoveAssignable` (Table [[tab:moveassignable]]) and
|
| 32 |
+
shall be constructible from the type of `*first`. `acc` (defined
|
| 33 |
+
below) shall be writable ([[iterator.requirements.general]]) to the
|
| 34 |
+
`result` output iterator. The result of the expression `val - acc` or
|
| 35 |
+
`binary_op(val, acc)` shall be writable to the `result` output
|
| 36 |
+
iterator.
|
| 37 |
+
- For the overloads with an `ExecutionPolicy`, the value type of
|
| 38 |
+
`ForwardIterator1` shall be `CopyConstructible`
|
| 39 |
+
(Table [[tab:copyconstructible]]), constructible from the expression
|
| 40 |
+
`*first - *first` or `binary_op(*first, *first)`, and assignable to
|
| 41 |
+
the value type of `ForwardIterator2`.
|
| 42 |
+
- For all overloads, in the ranges \[`first`, `last`\] and \[`result`,
|
| 43 |
+
`result + (last - first)`\], `binary_op` shall neither modify elements
|
| 44 |
+
nor invalidate iterators or subranges.[^17]
|
| 45 |
+
|
| 46 |
+
*Effects:* For the overloads with no `ExecutionPolicy` and a non-empty
|
| 47 |
+
range, the function creates an accumulator `acc` whose type is
|
| 48 |
+
`InputIterator`’s value type, initializes it with `*first`, and assigns
|
| 49 |
+
the result to `*result`. For every iterator `i` in \[`first + 1`,
|
| 50 |
+
`last`) in order, creates an object `val` whose type is
|
| 51 |
`InputIterator`’s value type, initializes it with `*i`, computes
|
| 52 |
`val - acc` or `binary_op(val, acc)`, assigns the result to
|
| 53 |
`*(result + (i - first))`, and move assigns from `val` to `acc`.
|
| 54 |
|
| 55 |
+
For the overloads with an `ExecutionPolicy` and a non-empty range, first
|
| 56 |
+
the function creates an object whose type is `ForwardIterator1`’s value
|
| 57 |
+
type, initializes it with `*first`, and assigns the result to `*result`.
|
| 58 |
+
Then for every `d` in \[`1`, `last - first - 1`\], creates an object
|
| 59 |
+
`val` whose type is `ForwardIterator1`’s value type, initializes it with
|
| 60 |
+
`*(first + d) - *(first + d - 1)` or
|
| 61 |
+
`binary_op(*(first + d), *(first + d - 1))`, and assigns the result to
|
| 62 |
+
`*(result + d)`.
|
|
|
|
| 63 |
|
| 64 |
*Returns:* `result + (last - first)`.
|
| 65 |
|
| 66 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
| 67 |
operation.
|
| 68 |
|
| 69 |
+
*Remarks:* For the overloads with no `ExecutionPolicy`, `result` may be
|
| 70 |
+
equal to `first`. For the overloads with an `ExecutionPolicy`, the
|
| 71 |
+
ranges \[`first`, `last`) and \[`result`, `result + (last - first)`)
|
| 72 |
+
shall not overlap.
|
| 73 |
+
|