tmp/tmppc49l5pe/{from.md → to.md}
RENAMED
|
@@ -1,28 +1,28 @@
|
|
| 1 |
### Inner product <a id="inner.product">[[inner.product]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator1, class InputIterator2, class T>
|
| 5 |
-
T inner_product(InputIterator1 first1, InputIterator1 last1,
|
| 6 |
InputIterator2 first2, T init);
|
| 7 |
template<class InputIterator1, class InputIterator2, class T,
|
| 8 |
class BinaryOperation1, class BinaryOperation2>
|
| 9 |
-
T inner_product(InputIterator1 first1, InputIterator1 last1,
|
| 10 |
InputIterator2 first2, T init,
|
| 11 |
BinaryOperation1 binary_op1,
|
| 12 |
BinaryOperation2 binary_op2);
|
| 13 |
```
|
| 14 |
|
| 15 |
-
*
|
| 16 |
-
(
|
| 17 |
-
(
|
| 18 |
`last1`\] and \[`first2`, `first2 + (last1 - first1)`\] `binary_op1` and
|
| 19 |
-
`binary_op2`
|
| 20 |
-
subranges.[^
|
| 21 |
|
| 22 |
*Effects:* Computes its result by initializing the accumulator `acc`
|
| 23 |
with the initial value `init` and then modifying it with
|
| 24 |
-
`acc = acc + (*i1) * (*i2)` or
|
| 25 |
-
`acc = binary_op1(acc, binary_op2(*i1, *i2))` for every
|
| 26 |
-
the range \[`first1`, `last1`) and iterator `i2` in the
|
| 27 |
-
\[`first2`, `first2 + (last1 - first1)`) in order.
|
| 28 |
|
|
|
|
| 1 |
### Inner product <a id="inner.product">[[inner.product]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator1, class InputIterator2, class T>
|
| 5 |
+
constexpr T inner_product(InputIterator1 first1, InputIterator1 last1,
|
| 6 |
InputIterator2 first2, T init);
|
| 7 |
template<class InputIterator1, class InputIterator2, class T,
|
| 8 |
class BinaryOperation1, class BinaryOperation2>
|
| 9 |
+
constexpr T inner_product(InputIterator1 first1, InputIterator1 last1,
|
| 10 |
InputIterator2 first2, T init,
|
| 11 |
BinaryOperation1 binary_op1,
|
| 12 |
BinaryOperation2 binary_op2);
|
| 13 |
```
|
| 14 |
|
| 15 |
+
*Preconditions:* `T` meets the *Cpp17CopyConstructible*
|
| 16 |
+
([[cpp17.copyconstructible]]) and *Cpp17CopyAssignable*
|
| 17 |
+
([[cpp17.copyassignable]]) requirements. In the ranges \[`first1`,
|
| 18 |
`last1`\] and \[`first2`, `first2 + (last1 - first1)`\] `binary_op1` and
|
| 19 |
+
`binary_op2` neither modifies elements nor invalidates iterators or
|
| 20 |
+
subranges. [^8]
|
| 21 |
|
| 22 |
*Effects:* Computes its result by initializing the accumulator `acc`
|
| 23 |
with the initial value `init` and then modifying it with
|
| 24 |
+
`acc = std::move(acc) + (*i1) * (*i2)` or
|
| 25 |
+
`acc = binary_op1(std::move(acc), binary_op2(*i1, *i2))` for every
|
| 26 |
+
iterator `i1` in the range \[`first1`, `last1`) and iterator `i2` in the
|
| 27 |
+
range \[`first2`, `first2 + (last1 - first1)`) in order.
|
| 28 |
|