tmp/tmp0d_p3els/{from.md → to.md}
RENAMED
|
@@ -1,67 +1,64 @@
|
|
| 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 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
`
|
| 36 |
-
iterator.
|
| 37 |
-
|
| 38 |
-
`
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
- For all overloads, in the ranges \[`first`, `last`\] and \[`result`,
|
| 43 |
-
`result + (last - first)`\], `binary_op`
|
| 44 |
-
|
| 45 |
|
| 46 |
*Effects:* For the overloads with no `ExecutionPolicy` and a non-empty
|
| 47 |
-
range, the function creates an accumulator `acc`
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
`
|
| 51 |
-
`
|
| 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,
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 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.
|
|
|
|
| 1 |
### Adjacent difference <a id="adjacent.difference">[[adjacent.difference]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class OutputIterator>
|
| 5 |
+
constexpr 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, ForwardIterator2 result);
|
|
|
|
| 12 |
|
| 13 |
template<class InputIterator, class OutputIterator, class BinaryOperation>
|
| 14 |
+
constexpr OutputIterator
|
| 15 |
adjacent_difference(InputIterator first, InputIterator last,
|
| 16 |
+
OutputIterator result, BinaryOperation binary_op);
|
|
|
|
| 17 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 18 |
class BinaryOperation>
|
| 19 |
ForwardIterator2
|
| 20 |
adjacent_difference(ExecutionPolicy&& exec,
|
| 21 |
ForwardIterator1 first, ForwardIterator1 last,
|
| 22 |
+
ForwardIterator2 result, BinaryOperation binary_op);
|
|
|
|
| 23 |
```
|
| 24 |
|
| 25 |
+
Let `T` be the value type of `decltype(first)`. For the overloads that
|
| 26 |
+
do not take an argument `binary_op`, let `binary_op` be an lvalue that
|
| 27 |
+
denotes an object of type `minus<>`.
|
| 28 |
+
|
| 29 |
+
*Mandates:*
|
| 30 |
+
|
| 31 |
+
- For the overloads with no `ExecutionPolicy`, `T` is constructible from
|
| 32 |
+
`*first`. `acc` (defined below) is
|
| 33 |
+
writable [[iterator.requirements.general]] to the `result` output
|
| 34 |
+
iterator. The result of the expression
|
| 35 |
+
`binary_op(val, std::move(acc))` is writable to `result`.
|
| 36 |
+
- For the overloads with an `ExecutionPolicy`, the result of the
|
| 37 |
+
expressions `binary_op(*first, *first)` and `*first` are writable to
|
| 38 |
+
`result`.
|
| 39 |
+
|
| 40 |
+
*Preconditions:*
|
| 41 |
+
|
| 42 |
+
- For the overloads with no `ExecutionPolicy`, `T` meets the
|
| 43 |
+
*Cpp17MoveAssignable* ([[cpp17.moveassignable]]) requirements.
|
| 44 |
- For all overloads, in the ranges \[`first`, `last`\] and \[`result`,
|
| 45 |
+
`result + (last - first)`\], `binary_op` neither modifies elements nor
|
| 46 |
+
invalidate iterators or subranges. [^10]
|
| 47 |
|
| 48 |
*Effects:* For the overloads with no `ExecutionPolicy` and a non-empty
|
| 49 |
+
range, the function creates an accumulator `acc` of type `T`,
|
| 50 |
+
initializes it with `*first`, and assigns the result to `*result`. For
|
| 51 |
+
every iterator `i` in \[`first + 1`, `last`) in order, creates an object
|
| 52 |
+
`val` whose type is `T`, initializes it with `*i`, computes
|
| 53 |
+
`binary_op(val, std::move(acc))`, assigns the result to
|
|
|
|
| 54 |
`*(result + (i - first))`, and move assigns from `val` to `acc`.
|
| 55 |
|
| 56 |
+
For the overloads with an `ExecutionPolicy` and a non-empty range,
|
| 57 |
+
performs `*result = *first`. Then, for every `d` in
|
| 58 |
+
`[1, last - first - 1]`, performs
|
| 59 |
+
`*(result + d) = binary_op(*(first + d), *(first + (d - 1)))`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
*Returns:* `result + (last - first)`.
|
| 62 |
|
| 63 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
| 64 |
operation.
|