Skip to content

Commit 81fe012

Browse files
burblebeetkoeppe
authored andcommitted
LWG4444 Fix default template arguments for ranges::replace and ranges::replace_if
Fixes NB US 159-259 (C++26 CD).
1 parent 7e4df5a commit 81fe012

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>
@@ -7152,26 +7153,26 @@
71527153
Predicate pred, const T& new_value);
71537154

71547155
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7155-
class T1 = projected_value_t<I, Proj>, class T2 = T1>
7156+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71567157
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71577158
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71587159
constexpr I
71597160
ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
71607161
template<@\libconcept{input_range}@ R, class Proj = identity,
7161-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
7162+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71627163
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71637164
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
71647165
constexpr borrowed_iterator_t<R>
71657166
ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
71667167

71677168
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
7168-
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = T1>
7169+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71697170
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71707171
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71717172
I ranges::replace(Ep&& exec, I first, S last,
71727173
const T1& old_value, const T2& new_value, Proj proj = {});
71737174
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
7174-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
7175+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71757176
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71767177
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
71777178
projected<iterator_t<R>, Proj>, const T1*>
@@ -7180,24 +7181,24 @@
71807181
Proj proj = {});
71817182

71827183
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7183-
class T = projected_value_t<I, Proj>,
7184+
class T = iter_value_t<I>,
71847185
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71857186
requires @\libconcept{indirectly_writable}@<I, const T&>
71867187
constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {});
7187-
template<@\libconcept{input_range}@ R, class Proj = identity, class T = projected_value_t<iterator_t<R>, Proj>,
7188+
template<@\libconcept{input_range}@ R, class Proj = identity, class T = range_value_t<R>,
71887189
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
71897190
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
71907191
constexpr borrowed_iterator_t<R>
71917192
ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
71927193

71937194
template<@\exposconcept{execution-policy}@ Ep, @\libconcept{random_access_iterator}@ I, @\libconcept{sized_sentinel_for}@<I> S,
7194-
class Proj = identity, class T = projected_value_t<I, Proj>,
7195+
class Proj = identity, class T = iter_value_t<I>,
71957196
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71967197
requires @\libconcept{indirectly_writable}@<I, const T&>
71977198
I ranges::replace_if(Ep&& exec, I first, S last, Pred pred,
71987199
const T& new_value, Proj proj = {});
71997200
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
7200-
class T = projected_value_t<iterator_t<R>, Proj>,
7201+
class T = range_value_t<R>,
72017202
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
72027203
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
72037204
borrowed_iterator_t<R>

0 commit comments

Comments
 (0)