This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
comp
Section: 26.8 [alg.sorting] Status: C++17 Submitter: Anton Savin Opened: 2015-04-14 Last modified: 2017-07-30
Priority: 0
View all other issues in [alg.sorting].
View all issues with C++17 status.
Discussion:
N4296 26.8 [alg.sorting]/3 reads:
For all algorithms that take
Compare
, there is a version that usesoperator<
instead. That is,comp(*i,*j) != false
defaults to*i < *j != false
. For algorithms other than those described in 25.4.3 to work correctly,comp
has to induce a strict weak ordering on the values.
So it's not specified clearly what happens if comp
or operator<
don't induce a strict weak ordering.
Is it undefined or implementation-defined behavior? It seems that it should be stated more clearly that the behavior is
undefined.
[2015-05, Lenexa]
Move to Immediate.
Proposed resolution:
This wording is relative to N4431.
Change 26.8 [alg.sorting]/3 to the following:
For all algorithms that take
Compare
, there is a version that usesoperator<
instead. That is,comp(*i, *j) != false
defaults to*i < *j != false
. For algorithms other than those described in 25.4.3to work correctly,comp
shallhas toinduce a strict weak ordering on the values.