tmp/tmpp84ab94y/{from.md → to.md}
RENAMED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
### Accumulate <a id="accumulate">[[accumulate]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class T>
|
| 5 |
-
T accumulate(InputIterator first, InputIterator last, T init);
|
| 6 |
template<class InputIterator, class T, class BinaryOperation>
|
| 7 |
-
T accumulate(InputIterator first, InputIterator last, T init,
|
| 8 |
BinaryOperation binary_op);
|
| 9 |
```
|
| 10 |
|
| 11 |
-
*
|
| 12 |
-
(
|
| 13 |
-
(
|
| 14 |
-
`binary_op`
|
| 15 |
-
subranges.[^
|
| 16 |
|
| 17 |
*Effects:* Computes its result by initializing the accumulator `acc`
|
| 18 |
-
with the initial value `init` and then modifies it with
|
| 19 |
-
|
| 20 |
-
\[`first`, `last`) in order.[^
|
| 21 |
|
|
|
|
| 1 |
### Accumulate <a id="accumulate">[[accumulate]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class T>
|
| 5 |
+
constexpr T accumulate(InputIterator first, InputIterator last, T init);
|
| 6 |
template<class InputIterator, class T, class BinaryOperation>
|
| 7 |
+
constexpr T accumulate(InputIterator first, InputIterator last, T init,
|
| 8 |
BinaryOperation binary_op);
|
| 9 |
```
|
| 10 |
|
| 11 |
+
*Preconditions:* `T` meets the *Cpp17CopyConstructible*
|
| 12 |
+
([[cpp17.copyconstructible]]) and *Cpp17CopyAssignable*
|
| 13 |
+
([[cpp17.copyassignable]]) requirements. In the range \[`first`,
|
| 14 |
+
`last`\], `binary_op` neither modifies elements nor invalidates
|
| 15 |
+
iterators or subranges. [^6]
|
| 16 |
|
| 17 |
*Effects:* Computes its result by initializing the accumulator `acc`
|
| 18 |
+
with the initial value `init` and then modifies it with
|
| 19 |
+
`acc = std::move(acc) + *i` or `acc = binary_op(std::move(acc), *i)` for
|
| 20 |
+
every iterator `i` in the range \[`first`, `last`) in order. [^7]
|
| 21 |
|