Title
list::sort should say that the order of elements is unspecified if an exception is thrown
Status
c++17
Section
[list.ops]
Submitter
Tim Song

Created on 2016-11-16.00:00:00 last changed 81 months ago

Messages

Date: 2017-01-30.15:17:53

Proposed resolution:

This wording is relative to N4606.

  1. Edit [list.ops] p29 as indicated:

    void sort();
    template <class Compare> void sort(Compare comp);
    

    -28- Requires: operator< (for the first version) or comp (for the second version) shall define a strict weak ordering ([alg.sorting]).

    -29- Effects: Sorts the list according to the operator< or a Compare function object. If an exception is thrown, the order of the elements in *this is unspecified. Does not affect the validity of iterators and references.

    […]

Date: 2017-01-27.00:00:00

[ 2017-01-27 Telecon ]

Priority 0

Date: 2016-11-16.00:00:00

Sometime between N1638 and N1804 the sentence "If an exception is thrown the order of the elements in the list is indeterminate." in the specification of list::sort went missing. This suspiciously coincided with the editorial change that "consolidated definitions of "Stable" in the library clauses" (N1805).

forward_list::sort says that "If an exception is thrown the order of the elements in *this is unspecified"; list::sort should do the same.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:41:16adminsetstatus: ready -> wp
2017-01-30 15:17:53adminsetmessages: + msg8801
2017-01-30 15:17:53adminsetstatus: new -> ready
2016-11-27 21:38:19adminsetmessages: + msg8695
2016-11-16 00:00:00admincreate