tmp/tmpfnc_fsj4/{from.md → to.md}
RENAMED
|
@@ -1,51 +1,96 @@
|
|
| 1 |
### Transform <a id="alg.transform">[[alg.transform]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class OutputIterator,
|
| 5 |
class UnaryOperation>
|
| 6 |
-
OutputIterator
|
| 7 |
-
transform(InputIterator
|
| 8 |
OutputIterator result, UnaryOperation op);
|
| 9 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10 |
class UnaryOperation>
|
| 11 |
ForwardIterator2
|
| 12 |
transform(ExecutionPolicy&& exec,
|
| 13 |
-
ForwardIterator1
|
| 14 |
ForwardIterator2 result, UnaryOperation op);
|
| 15 |
|
| 16 |
template<class InputIterator1, class InputIterator2,
|
| 17 |
class OutputIterator, class BinaryOperation>
|
| 18 |
-
OutputIterator
|
| 19 |
transform(InputIterator1 first1, InputIterator1 last1,
|
| 20 |
InputIterator2 first2, OutputIterator result,
|
| 21 |
BinaryOperation binary_op);
|
| 22 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 23 |
class ForwardIterator, class BinaryOperation>
|
| 24 |
ForwardIterator
|
| 25 |
transform(ExecutionPolicy&& exec,
|
| 26 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 27 |
ForwardIterator2 first2, ForwardIterator result,
|
| 28 |
BinaryOperation binary_op);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
```
|
| 30 |
|
| 31 |
-
|
| 32 |
-
subranges, or modify elements in the ranges
|
| 33 |
|
| 34 |
-
-
|
| 35 |
-
|
| 36 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 39 |
-
`result +
|
| 40 |
-
`op(*(first1 + (i - result)))` or
|
| 41 |
-
`binary_op(*(first1 + (i - result)), *(first2 + (i - result)))`.
|
| 42 |
|
| 43 |
-
*Returns:*
|
| 44 |
|
| 45 |
-
|
| 46 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
`ExecutionPolicy`.
|
| 48 |
|
| 49 |
-
*Remarks:* `result` may be equal to `
|
| 50 |
-
or to `first1` or `first2` in case of binary transform.
|
| 51 |
|
|
|
|
| 1 |
### Transform <a id="alg.transform">[[alg.transform]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class InputIterator, class OutputIterator,
|
| 5 |
class UnaryOperation>
|
| 6 |
+
constexpr OutputIterator
|
| 7 |
+
transform(InputIterator first1, InputIterator last1,
|
| 8 |
OutputIterator result, UnaryOperation op);
|
| 9 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 10 |
class UnaryOperation>
|
| 11 |
ForwardIterator2
|
| 12 |
transform(ExecutionPolicy&& exec,
|
| 13 |
+
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 14 |
ForwardIterator2 result, UnaryOperation op);
|
| 15 |
|
| 16 |
template<class InputIterator1, class InputIterator2,
|
| 17 |
class OutputIterator, class BinaryOperation>
|
| 18 |
+
constexpr OutputIterator
|
| 19 |
transform(InputIterator1 first1, InputIterator1 last1,
|
| 20 |
InputIterator2 first2, OutputIterator result,
|
| 21 |
BinaryOperation binary_op);
|
| 22 |
template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2,
|
| 23 |
class ForwardIterator, class BinaryOperation>
|
| 24 |
ForwardIterator
|
| 25 |
transform(ExecutionPolicy&& exec,
|
| 26 |
ForwardIterator1 first1, ForwardIterator1 last1,
|
| 27 |
ForwardIterator2 first2, ForwardIterator result,
|
| 28 |
BinaryOperation binary_op);
|
| 29 |
+
|
| 30 |
+
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 31 |
+
copy_constructible F, class Proj = identity>
|
| 32 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
|
| 33 |
+
constexpr ranges::unary_transform_result<I, O>
|
| 34 |
+
ranges::transform(I first1, S last1, O result, F op, Proj proj = {});
|
| 35 |
+
template<input_range R, weakly_incrementable O, copy_constructible F,
|
| 36 |
+
class Proj = identity>
|
| 37 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
|
| 38 |
+
constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
|
| 39 |
+
ranges::transform(R&& r, O result, F op, Proj proj = {});
|
| 40 |
+
template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
|
| 41 |
+
weakly_incrementable O, copy_constructible F, class Proj1 = identity,
|
| 42 |
+
class Proj2 = identity>
|
| 43 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
|
| 44 |
+
projected<I2, Proj2>>>
|
| 45 |
+
constexpr ranges::binary_transform_result<I1, I2, O>
|
| 46 |
+
ranges::transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
|
| 47 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 48 |
+
template<input_range R1, input_range R2, weakly_incrementable O,
|
| 49 |
+
copy_constructible F, class Proj1 = identity, class Proj2 = identity>
|
| 50 |
+
requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
|
| 51 |
+
projected<iterator_t<R2>, Proj2>>>
|
| 52 |
+
constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
|
| 53 |
+
ranges::transform(R1&& r1, R2&& r2, O result,
|
| 54 |
+
F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
|
| 55 |
```
|
| 56 |
|
| 57 |
+
Let:
|
|
|
|
| 58 |
|
| 59 |
+
- `last2` be `first2 + (last1 - first1)` for the overloads with
|
| 60 |
+
parameter `first2` but no parameter `last2`;
|
| 61 |
+
- N be `last1 - first1` for unary transforms, or
|
| 62 |
+
min(`last1 - first1`, `last2 - first2`) for binary transforms;
|
| 63 |
+
- E be
|
| 64 |
+
- `op(*(first1 + (i - result)))` for unary transforms defined in
|
| 65 |
+
namespace `std`;
|
| 66 |
+
- `binary_op(*(first1 + (i - result)), *(first2 + (i - result)))` for
|
| 67 |
+
binary transforms defined in namespace `std`;
|
| 68 |
+
- `invoke(op, invoke(proj, *(first1 + (i - result))))` for unary
|
| 69 |
+
transforms defined in namespace `ranges`;
|
| 70 |
+
- `invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,*(first2 + (i - result))))`
|
| 71 |
+
for binary transforms defined in namespace `ranges`.
|
| 72 |
+
|
| 73 |
+
*Preconditions:* `op` and `binary_op` do not invalidate iterators or
|
| 74 |
+
subranges, nor modify elements in the ranges
|
| 75 |
+
|
| 76 |
+
- \[`first1`, `first1 + `N\],
|
| 77 |
+
- \[`first2`, `first2 + `N\], and
|
| 78 |
+
- \[`result`, `result + `N\]. [^4]
|
| 79 |
|
| 80 |
*Effects:* Assigns through every iterator `i` in the range \[`result`,
|
| 81 |
+
`result + `N) a new corresponding value equal to E.
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
*Returns:*
|
| 84 |
|
| 85 |
+
- `result + `N for the overloads defined in namespace `std`.
|
| 86 |
+
- `{first1 + `N`, result + `N`}` for unary transforms defined in
|
| 87 |
+
namespace `ranges`.
|
| 88 |
+
- `{first1 + `N`, first2 + `N`, result + `N`}` for binary transforms
|
| 89 |
+
defined in namespace `ranges`.
|
| 90 |
+
|
| 91 |
+
*Complexity:* Exactly N applications of `op` or `binary_op`, and any
|
| 92 |
+
projections. This requirement also applies to the overload with an
|
| 93 |
`ExecutionPolicy`.
|
| 94 |
|
| 95 |
+
*Remarks:* `result` may be equal to `first1` or `first2`.
|
|
|
|
| 96 |
|