Section: 26.8.1 [alg.sorting.general] Status: C++23 Submitter: Casey Carter Opened: 2022-06-10 Last modified: 2023-11-22
Priority: Not Prioritized
View all issues with C++23 status.
Discussion:
P0896R4 changed the term of art "sorted with respect to comparator" defined in 26.8.1 [alg.sorting.general] paragraph 5 to "sorted with respect to comparator and projection." That proposal updated the algorithm specifications consistently. However, there were uses of the old term outside of 26 [algorithms] that are now without meaning. We should bring back the term "sorted with respect to comparator" to fix that lack.
[2022-06-21; Reflector poll]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
[2022-07-15; LWG telecon: move to Ready]
[2022-07-25 Approved at July 2022 virtual plenary. Status changed: Ready → WP.]
Proposed resolution:
This wording is relative to N4910.
Modify 26.8.1 [alg.sorting.general] as indicated:
-5- A sequence is sorted with respect to a
comp
andproj
for a comparator and projectioncomp
andproj
if for every iteratori
pointing to the sequence and every non-negative integern
such thati + n
is a valid iterator pointing to an element of the sequence,bool(invoke(comp, invoke(proj, *(i + n)), invoke(proj, *i)))is
-?- A sequence is sorted with respect to a comparatorfalse
.comp
for a comparatorcomp
if it is sorted with respect tocomp
andidentity{}
(the identity projection).