Skip to content

Commit 721d01c

Browse files
authored
Merge 2025-11 LWG Motion 2
P3906R0 C++ Standard Library Immediate Issues to be moved in Kona, Nov. 2025
2 parents 80b091d + d3e367d commit 721d01c

File tree

11 files changed

+556
-474
lines changed

11 files changed

+556
-474
lines changed

source/algorithms.tex

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@
233233
\end{codeblock}
234234
For each iterator \tcode{i} and sentinel \tcode{s}
235235
produced from a range \tcode{r},
236-
the semantics of \tcode{s - i} has the same type, value, and value category
236+
the semantics of \tcode{s - i}
237+
are the same as those of an expression that
238+
has the same type, value, and value category
237239
as \tcode{ranges::distance(i, s)}.
238240
\begin{note}
239241
The implementation can use \tcode{ranges::distance(r)}
@@ -379,7 +381,9 @@
379381
\tcode{BinaryOperation1},
380382
\tcode{BinaryOperation2},
381383
\tcode{BinaryDivideOp}, or
382-
constrained by a concept that subsumes \libconcept{regular_invocable}
384+
constrained by a concept
385+
whose semantic requirements include
386+
that the type models \libconcept{regular_invocable}
383387
and the operators used by the analogous overloads to these parallel algorithms
384388
that are formed by an invocation
385389
with the specified default predicate or operation (where applicable)
@@ -2097,27 +2101,28 @@
20972101

20982102
namespace ranges {
20992103
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
2100-
class T1 = projected_value_t<I, Proj>, class T2 = T1>
2104+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
21012105
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
21022106
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
21032107
constexpr I
21042108
replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
21052109
template<@\libconcept{input_range}@ R, class Proj = identity,
2106-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
2110+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
21072111
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
21082112
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
21092113
projected<iterator_t<R>, Proj>, const T1*>
21102114
constexpr borrowed_iterator_t<R>
21112115
replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
21122116

21132117
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>
2118+
class Proj = identity,
2119+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
21152120
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
21162121
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
21172122
I replace(Ep&& exec, I first, S last,
21182123
const T1& old_value, const T2& new_value, Proj proj = {}); // freestanding-deleted
21192124
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>
2125+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
21212126
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
21222127
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
21232128
projected<iterator_t<R>, Proj>, const T1*>
@@ -2126,24 +2131,24 @@
21262131
Proj proj = {}); // freestanding-deleted
21272132

21282133
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
2129-
class T = projected_value_t<I, Proj>,
2134+
class T = iter_value_t<I>,
21302135
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
21312136
requires @\libconcept{indirectly_writable}@<I, const T&>
21322137
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>,
2138+
template<@\libconcept{input_range}@ R, class Proj = identity, class T = range_value_t<R>,
21342139
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
21352140
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
21362141
constexpr borrowed_iterator_t<R>
21372142
replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
21382143

21392144
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>,
2145+
class Proj = identity, class T = iter_value_t<I>,
21412146
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
21422147
requires @\libconcept{indirectly_writable}@<I, const T&>
21432148
I replace_if(Ep&& exec, I first, S last, Pred pred,
21442149
const T& new_value, Proj proj = {}); // freestanding-deleted
21452150
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
2146-
class T = projected_value_t<iterator_t<R>, Proj>,
2151+
class T = range_value_t<R>,
21472152
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
21482153
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
21492154
borrowed_iterator_t<R>
@@ -7152,26 +7157,26 @@
71527157
Predicate pred, const T& new_value);
71537158

71547159
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7155-
class T1 = projected_value_t<I, Proj>, class T2 = T1>
7160+
class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71567161
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71577162
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71587163
constexpr I
71597164
ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {});
71607165
template<@\libconcept{input_range}@ R, class Proj = identity,
7161-
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = T1>
7166+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71627167
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71637168
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
71647169
constexpr borrowed_iterator_t<R>
71657170
ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {});
71667171

71677172
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>
7173+
class Proj = identity, class T1 = projected_value_t<I, Proj>, class T2 = iter_value_t<I>>
71697174
requires @\libconcept{indirectly_writable}@<I, const T2&> &&
71707175
@\libconcept{indirect_binary_predicate}@<ranges::equal_to, projected<I, Proj>, const T1*>
71717176
I ranges::replace(Ep&& exec, I first, S last,
71727177
const T1& old_value, const T2& new_value, Proj proj = {});
71737178
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>
7179+
class T1 = projected_value_t<iterator_t<R>, Proj>, class T2 = range_value_t<R>>
71757180
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T2&> &&
71767181
@\libconcept{indirect_binary_predicate}@<ranges::equal_to,
71777182
projected<iterator_t<R>, Proj>, const T1*>
@@ -7180,24 +7185,24 @@
71807185
Proj proj = {});
71817186

71827187
template<@\libconcept{input_iterator}@ I, @\libconcept{sentinel_for}@<I> S, class Proj = identity,
7183-
class T = projected_value_t<I, Proj>,
7188+
class T = iter_value_t<I>,
71847189
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71857190
requires @\libconcept{indirectly_writable}@<I, const T&>
71867191
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>,
7192+
template<@\libconcept{input_range}@ R, class Proj = identity, class T = range_value_t<R>,
71887193
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
71897194
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
71907195
constexpr borrowed_iterator_t<R>
71917196
ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {});
71927197

71937198
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>,
7199+
class Proj = identity, class T = iter_value_t<I>,
71957200
@\libconcept{indirect_unary_predicate}@<projected<I, Proj>> Pred>
71967201
requires @\libconcept{indirectly_writable}@<I, const T&>
71977202
I ranges::replace_if(Ep&& exec, I first, S last, Pred pred,
71987203
const T& new_value, Proj proj = {});
71997204
template<@\exposconcept{execution-policy}@ Ep, @\exposconcept{sized-random-access-range}@ R, class Proj = identity,
7200-
class T = projected_value_t<iterator_t<R>, Proj>,
7205+
class T = range_value_t<R>,
72017206
@\libconcept{indirect_unary_predicate}@<projected<iterator_t<R>, Proj>> Pred>
72027207
requires @\libconcept{indirectly_writable}@<iterator_t<R>, const T&>
72037208
borrowed_iterator_t<R>
@@ -8261,7 +8266,8 @@
82618266
\effects
82628267
Equivalent to:
82638268
\begin{codeblock}
8264-
return ranges::rotate(std::forward<Ep>(exec), ranges::begin(r), middle, ranges::end(r));
8269+
return ranges::rotate(std::forward<Ep>(exec), ranges::begin(r), middle,
8270+
ranges::begin(r) + ranges::distance(r));
82658271
\end{codeblock}
82668272
\end{itemdescr}
82678273

@@ -8386,8 +8392,10 @@
83868392
\effects
83878393
Equivalent to:
83888394
\begin{codeblock}
8389-
return ranges::rotate_copy(std::forward<Ep>(exec), ranges::begin(r), middle, ranges::end(r),
8390-
ranges::begin(result_r), ranges::end(result_r));
8395+
return ranges::rotate_copy(std::forward<Ep>(exec), ranges::begin(r), middle,
8396+
ranges::begin(r) + ranges::distance(r),
8397+
ranges::begin(result_r),
8398+
ranges::begin(result_r) + ranges::distance(result_r));
83918399
\end{codeblock}
83928400
\end{itemdescr}
83938401

@@ -9007,7 +9015,8 @@
90079015
Equivalent to:
90089016
\begin{codeblock}
90099017
return ranges::partial_sort(std::forward<Ep>(exec), ranges::begin(r), middle,
9010-
ranges::end(r), comp, proj);
9018+
ranges::begin(r) + ranges::distance(r),
9019+
comp, proj);
90119020
\end{codeblock}
90129021
\end{itemdescr}
90139022

@@ -9391,7 +9400,8 @@
93919400
\effects
93929401
Equivalent to:
93939402
\begin{codeblock}
9394-
return ranges::nth_element(std::forward<Ep>(exec), ranges::begin(r), nth, ranges::end(r),
9403+
return ranges::nth_element(std::forward<Ep>(exec), ranges::begin(r), nth,
9404+
ranges::begin(r) + ranges::distance(r),
93959405
comp, proj);
93969406
\end{codeblock}
93979407
\end{itemdescr}
@@ -9955,19 +9965,19 @@
99559965
\effects
99569966
For each iterator \tcode{i} in \range{first}{first + $N$},
99579967
copies \tcode{*i} to the output range \range{out_true}{last_true}
9958-
if \tcode{$E(\tcode{*i})$} is \tcode{true}, or
9968+
if $E(\tcode{*i})$ is \tcode{true}, or
99599969
to the output range \range{out_false}{last_false} otherwise.
99609970

99619971
\pnum
99629972
\returns
9963-
Let \tcode{o1} be the iterator past the last copied element
9964-
in the output range \range{out_true}{last_true},
9965-
and \tcode{o2} be the iterator past the last copied element
9966-
in the output range \range{out_false}{last_false}.
9973+
Let $Q$ be the number of elements copied
9974+
into the output range \range{out_true}{last_true},
9975+
and $V$ be the number of elements copied
9976+
into the output range \range{out_false}{last_false}.
99679977
Returns:
99689978
\begin{itemize}
9969-
\item \tcode{\{o1, o2\}} for the overloads in namespace \tcode{std}.
9970-
\item \tcode{\{first + $N$, o1, o2\}} for the overloads in namespace \tcode{ranges}.
9979+
\item \tcode{\{out_true + $Q$, out_false + $V$\}} for the overloads in namespace \tcode{std}.
9980+
\item \tcode{\{first + $N$, out_true + $Q$, out_false + $V$\}} for the overloads in namespace \tcode{ranges}.
99719981
\end{itemize}
99729982

99739983
\pnum
@@ -10097,12 +10107,12 @@
1009710107
\tcode{proj2} be \tcode{identity\{\}},
1009810108
for the overloads with no parameters by those names;
1009910109
\item
10100-
$E(\tcode{e1}, \tcode{e1})$ be \tcode{bool(invoke(comp, invoke(proj2, e2), invoke(proj1, e1)))};
10110+
$E$ be \tcode{bool(invoke(comp, invoke(proj2, e2), invoke(proj1, e1)))};
1010110111
\item
1010210112
$K$ be the smallest integer in \range{0}{last1 - first1}
1010310113
such that for the element \tcode{e1} in the position \tcode{first1 + $K$}
1010410114
there are at least $N - K$ elements \tcode{e2}
10105-
in \range{first2}{last2} for which $E(\tcode{e1}, \tcode{e1})$ holds,
10115+
in \range{first2}{last2} for which $E$ holds,
1010610116
and be equal to \tcode{last1 - first1}
1010710117
if no such integer exists.
1010810118
\begin{note}
@@ -10127,7 +10137,7 @@
1012710137
If \tcode{e1} is an element of \range{first1}{last1} and
1012810138
\tcode{e2} of \range{first2}{last2},
1012910139
\tcode{e2} is copied into the output range before \tcode{e1}
10130-
if and only if $E(\tcode{e1}, \tcode{e1})$ is \tcode{true}.
10140+
if and only if $E$ is \tcode{true}.
1013110141

1013210142
\pnum
1013310143
\returns
@@ -10264,7 +10274,8 @@
1026410274
Equivalent to:
1026510275
\begin{codeblock}
1026610276
return ranges::inplace_merge(std::forward<Ep>(exec), ranges::begin(r), middle,
10267-
ranges::end(r), comp, proj);
10277+
ranges::begin(r) + ranges::distance(r),
10278+
comp, proj);
1026810279
\end{codeblock}
1026910280
\end{itemdescr}
1027010281

@@ -13541,7 +13552,7 @@
1354113552
}
1354213553

1354313554
template<class I>
13544-
decltype(auto) @\exposid{deref-move}@(I& it) {
13555+
constexpr decltype(auto) @\exposid{deref-move}@(I& it) {
1354513556
if constexpr (is_lvalue_reference_v<decltype(*it)>)
1354613557
return std::move(*it);
1354713558
else

0 commit comments

Comments
 (0)