Title
Clarify requirements for comp
Status
c++17
Section
[alg.sorting]
Submitter
Anton Savin

Created on 2015-04-14.00:00:00 last changed 89 months ago

Messages

Date: 2015-05-07.19:30:46

Proposed resolution:

This wording is relative to N4431.

  1. Change [alg.sorting]/3 to the following:

    For all algorithms that take Compare, there is a version that uses operator< 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 shallhas to induce a strict weak ordering on the values.

Date: 2015-05-07.19:30:46

[ 2015-05, Lenexa ]

Move to Immediate.

Date: 2015-04-14.00:00:00

N4296 [alg.sorting]/3 reads:

For all algorithms that take Compare, there is a version that uses operator< 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.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-10-27 16:52:45adminsetstatus: ready -> wp
2015-05-20 14:24:57adminsetstatus: immediate -> ready
2015-05-07 19:30:46adminsetmessages: + msg7372
2015-05-07 19:30:46adminsetstatus: new -> immediate
2015-04-14 18:04:09adminsetmessages: + msg7343
2015-04-14 00:00:00admincreate