tmp/tmpgdbqnc1b/{from.md → to.md}
RENAMED
|
@@ -3,17 +3,25 @@
|
|
| 3 |
``` cpp
|
| 4 |
template <class InputIterator, class OutputIterator>
|
| 5 |
OutputIterator partial_sum(
|
| 6 |
InputIterator first, InputIterator last,
|
| 7 |
OutputIterator result);
|
| 8 |
-
template
|
| 9 |
-
<class InputIterator, class OutputIterator, class BinaryOperation>
|
| 10 |
OutputIterator partial_sum(
|
| 11 |
InputIterator first, InputIterator last,
|
| 12 |
OutputIterator result, BinaryOperation binary_op);
|
| 13 |
```
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
*Effects:* For a non-empty range, the function creates an accumulator
|
| 16 |
`acc` whose type is `InputIterator`’s value type, initializes it with
|
| 17 |
`*first`, and assigns the result to `*result`. For every iterator `i` in
|
| 18 |
\[`first + 1`, `last`) in order, `acc` is then modified by
|
| 19 |
`acc = acc + *i` or `acc = binary_op(acc, *i)` and the result is
|
|
@@ -22,16 +30,7 @@ assigned to `*(result + (i - first))`.
|
|
| 22 |
*Returns:* `result + (last - first)`.
|
| 23 |
|
| 24 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
| 25 |
operation.
|
| 26 |
|
| 27 |
-
*Requires:* `InputIterator`’s value type shall be constructible from the
|
| 28 |
-
type of `*first`. The result of the expression `acc + *i` or
|
| 29 |
-
`binary_op(acc, *i)` shall be implicitly convertible to
|
| 30 |
-
`InputIterator`’s value type. `acc` shall be writable to the `result`
|
| 31 |
-
output iterator. In the ranges \[`first`, `last`\] and
|
| 32 |
-
{\[}\texttt{result}, \texttt{result + (last - first)}{\]} `binary_op`
|
| 33 |
-
shall neither modify elements nor invalidate iterators or
|
| 34 |
-
subranges.[^18]
|
| 35 |
-
|
| 36 |
*Remarks:* `result` may be equal to `first`.
|
| 37 |
|
|
|
|
| 3 |
``` cpp
|
| 4 |
template <class InputIterator, class OutputIterator>
|
| 5 |
OutputIterator partial_sum(
|
| 6 |
InputIterator first, InputIterator last,
|
| 7 |
OutputIterator result);
|
| 8 |
+
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
|
|
|
| 9 |
OutputIterator partial_sum(
|
| 10 |
InputIterator first, InputIterator last,
|
| 11 |
OutputIterator result, BinaryOperation binary_op);
|
| 12 |
```
|
| 13 |
|
| 14 |
+
*Requires:* `InputIterator`’s value type shall be constructible from the
|
| 15 |
+
type of `*first`. The result of the expression `acc + *i` or
|
| 16 |
+
`binary_op(acc, *i)` shall be implicitly convertible to
|
| 17 |
+
`InputIterator`’s value type. `acc` shall be
|
| 18 |
+
writable ([[iterator.requirements.general]]) to the `result` output
|
| 19 |
+
iterator. In the ranges \[`first`, `last`\] and \[`result`,
|
| 20 |
+
`result + (last - first)`\] `binary_op` shall neither modify elements
|
| 21 |
+
nor invalidate iterators or subranges.[^16]
|
| 22 |
+
|
| 23 |
*Effects:* For a non-empty range, the function creates an accumulator
|
| 24 |
`acc` whose type is `InputIterator`’s value type, initializes it with
|
| 25 |
`*first`, and assigns the result to `*result`. For every iterator `i` in
|
| 26 |
\[`first + 1`, `last`) in order, `acc` is then modified by
|
| 27 |
`acc = acc + *i` or `acc = binary_op(acc, *i)` and the result is
|
|
|
|
| 30 |
*Returns:* `result + (last - first)`.
|
| 31 |
|
| 32 |
*Complexity:* Exactly `(last - first) - 1` applications of the binary
|
| 33 |
operation.
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
*Remarks:* `result` may be equal to `first`.
|
| 36 |
|