Skip to content

Commit 4c4c8d2

Browse files
committed
LWG4444 Fix default template arguments for ranges::replace and ranges::replace_if
Fixes US 159-259 (C++26 CD).
1 parent 56e426e commit 4c4c8d2

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

source/algorithms.tex

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,27 +2097,28 @@
20972097

20982098
namespace ranges {
20992099
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
2100-
class T1 = projected_value_t<I, Proj>, class T2 = T1>
2100+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
21012101
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
21022102
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
21032103
constexpr I
21042104
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
21052105
template<@\libconcept{input_range}@ R, class Proj = identity,
2106-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
2106+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
21072107
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
21082108
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
21092109
projected<iterator_t<R>, Proj>, const T1*>
21102110
constexpr borrowed_iterator_t<R>
21112111
replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
21122112

21132113
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
2114-
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = T1>
2114+
class Proj = identity,
2115+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
21152116
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
21162117
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
21172118
I replace(Ep&& exec, I first, S last,
21182119
const T1& old_value, const T2& new_value, Proj proj = {}); // freestanding-deleted
21192120
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
2120-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
2121+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
21212122
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
21222123
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
21232124
projected<iterator_t<R>, Proj>, const T1*>
@@ -2126,24 +2127,24 @@
21262127
Proj proj = {}); // freestanding-deleted
21272128

21282129
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
2129-
class T = projected_value_t<I, Proj>,
2130+
class T = iter_value_t<I>,
21302131
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
21312132
requires @\libconcept{indirectly_writable}@<I, const T&>
21322133
constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
2133-
template<@\libconcept{input_range}@ R, class Proj = identity, class T = projected_value_t<I, Proj>,
2134+
template<@\libconcept{input_range}@ R, class Proj = identity, class T = range_value_t<R>,
21342135
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
21352136
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
21362137
constexpr borrowed_iterator_t<R>
21372138
replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
21382139

21392140
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
2140-
class Proj = identity, class T = projected_value_t<I, Proj>,
2141+
class Proj = identity, class T = iter_value_t<I>,
21412142
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
21422143
requires @\libconcept{indirectly_writable}@<I, const T&>
21432144
I replace_if(Ep&& exec, I first, S last, Pred pred,
21442145
const T& new_value, Proj proj = {}); // freestanding-deleted
21452146
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
2146-
class T = projected_value_t<iterator_t<R>, Proj>,
2147+
class T = range_value_t<R>,
21472148
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
21482149
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
21492150
borrowed_iterator_t<R>
@@ -7149,26 +7150,26 @@
71497150
Predicate pred, const T& new_value);
71507151

71517152
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7152-
class T1 = projected_value_t<I, Proj>, class T2 = T1>
7153+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71537154
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71547155
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71557156
constexpr I
71567157
ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
71577158
template<@\libconcept{input_range}@ R, class Proj = identity,
7158-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
7159+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71597160
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71607161
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
71617162
constexpr borrowed_iterator_t<R>
71627163
ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
71637164

71647165
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
7165-
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = T1>
7166+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71667167
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71677168
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71687169
I ranges::replace(Ep&& exec, I first, S last,
71697170
const T1& old_value, const T2& new_value, Proj proj = {});
71707171
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
7171-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
7172+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71727173
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71737174
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
71747175
projected<iterator_t<R>, Proj>, const T1*>
@@ -7177,24 +7178,24 @@
71777178
Proj proj = {});
71787179

71797180
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7180-
class T = projected_value_t<I, Proj>,
7181+
class T = iter_value_t<I>,
71817182
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71827183
requires @\libconcept{indirectly_writable}@<I, const T&>
71837184
constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
7184-
template<@\libconcept{input_range}@ R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>,
7185+
template<@\libconcept{input_range}@ R, class Proj = identity, class T = range_value_t<R>,
71857186
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
71867187
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
71877188
constexpr borrowed_iterator_t<R>
71887189
ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
71897190

71907191
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
7191-
class Proj = identity, class T = projected_value_t<I, Proj>,
7192+
class Proj = identity, class T = iter_value_t<I>,
71927193
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71937194
requires @\libconcept{indirectly_writable}@<I, const T&>
71947195
I ranges::replace_if(Ep&& exec, I first, S last, Pred pred,
71957196
const T& new_value, Proj proj = {});
71967197
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
7197-
class T = projected_value_t<iterator_t<R>, Proj>,
7198+
class T = range_value_t<R>,
71987199
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
71997200
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
72007201
borrowed_iterator_t<R>

0 commit comments

Comments
 (0)