From Jason Turner

[alg.transform]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0dfook3a/{from.md → to.md} +50 -9
tmp/tmp0dfook3a/{from.md → to.md} RENAMED
@@ -35,10 +35,25 @@ template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
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>>>
@@ -50,47 +65,73 @@ template<input_range R1, input_range R2, weakly_incrementable O,
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
 
 
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
+
41
+ template<execution-policy Ep, random_access_iterator I, sized_sentinel_for<I> S,
42
+ random_access_iterator O, sized_sentinel_for<O> OutS,
43
+ copy_constructible F, class Proj = identity>
44
+ requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
45
+ ranges::unary_transform_result<I, O>
46
+ ranges::transform(Ep&& exec, I first1, S last1, O result, OutS result_last,
47
+ F op, Proj proj = {});
48
+ template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR,
49
+ copy_constructible F, class Proj = identity>
50
+ requires indirectly_writable<iterator_t<OutR>,
51
+ indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
52
+ ranges::unary_transform_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR>>
53
+ ranges::transform(Ep&& exec, R&& r, OutR&& result_r, F op, Proj proj = {});
54
+
55
  template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
56
  weakly_incrementable O, copy_constructible F, class Proj1 = identity,
57
  class Proj2 = identity>
58
  requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
59
  projected<I2, Proj2>>>
 
65
  requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
66
  projected<iterator_t<R2>, Proj2>>>
67
  constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
68
  ranges::transform(R1&& r1, R2&& r2, O result,
69
  F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
70
+
71
+ template<execution-policy Ep, random_access_iterator I1, sized_sentinel_for<I1> S1,
72
+ random_access_iterator I2, sized_sentinel_for<I2> S2,
73
+ random_access_iterator O, sized_sentinel_for<O> OutS,
74
+ copy_constructible F, class Proj1 = identity, class Proj2 = identity>
75
+ requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
76
+ projected<I2, Proj2>>>
77
+ ranges::binary_transform_result<I1, I2, O>
78
+ ranges::transform(Ep&& exec, I1 first1, S1 last1, I2 first2, S2 last2,
79
+ O result, OutS result_last,
80
+ F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
81
+ template<execution-policy Ep, sized-random-access-range R1, sized-random-access-range R2,
82
+ sized-random-access-range OutR, copy_constructible F,
83
+ class Proj1 = identity, class Proj2 = identity>
84
+ requires indirectly_writable<iterator_t<OutR>,
85
+ indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
86
+ projected<iterator_t<R2>, Proj2>>>
87
+ ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>,
88
+ borrowed_iterator_t<OutR>>
89
+ ranges::transform(Ep&& exec, R1&& r1, R2&& r2, OutR&& result_r,
90
+ F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {});
91
  ```
92
 
93
  Let:
94
 
95
+ - `last2` be `first2 + (last1 - first1)` for the overloads in namespace
96
+ `std` with parameter `first2` but no parameter `last2`;
97
+ - M be `last1 - first1` for unary transforms, or
98
  min(`last1 - first1`, `last2 - first2`) for binary transforms;
99
+ - `result_last` be `result + `M for the overloads with no parameter
100
+ `result_last` or `result_r`;
101
+ - N be min(M, `result_last - result`);
102
+ - E(`i`) be
103
  - `op(*(first1 + (i - result)))` for unary transforms defined in
104
  namespace `std`;
105
  - `binary_op(*(first1 + (i - result)), *(first2 + (i - result)))` for
106
  binary transforms defined in namespace `std`;
107
  - `invoke(op, invoke(proj, *(first1 + (i - result))))` for unary
108
  transforms defined in namespace `ranges`;
109
  - `invoke(binary_op, invoke(proj1, *(first1 + (i - result))), invoke(proj2,*(first2 + (i - result))))`
110
  for binary transforms defined in namespace `ranges`.
111
 
112
+ *Preconditions:* For parallel algorithm overloads `op` and `binary_op`
113
+ satisfy the requirements specified in [[algorithms.parallel.user]]. `op`
114
+ and `binary_op` do not invalidate iterators or subranges, nor modify
115
+ elements in the ranges
116
 
117
  - \[`first1`, `first1 + `N\],
118
  - \[`first2`, `first2 + `N\], and
119
  - \[`result`, `result + `N\].[^4]
120
 
121
  *Effects:* Assigns through every iterator `i` in the range \[`result`,
122
+ `result + `N) a new corresponding value equal to E(`i`).
123
 
124
  *Returns:*
125
 
126
  - `result + `N for the overloads defined in namespace `std`.
127
  - `{first1 + `N`, result + `N`}` for unary transforms defined in
128
  namespace `ranges`.
129
  - `{first1 + `N`, first2 + `N`, result + `N`}` for binary transforms
130
  defined in namespace `ranges`.
131
 
132
  *Complexity:* Exactly N applications of `op` or `binary_op`, and any
133
+ projections. This requirement also applies to the parallel algorithm
134
+ overloads.
135
 
136
  *Remarks:* `result` may be equal to `first1` or `first2`.
137