list::sort
should say that the order of elements is unspecified if an exception is thrownSection: 23.3.9.5 [list.ops] Status: C++17 Submitter: Tim Song Opened: 2016-11-16 Last modified: 2017-07-30
Priority: 0
View all other issues in [list.ops].
View all issues with C++17 status.
Discussion:
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.
[2017-01-27 Telecon]
Priority 0
Proposed resolution:
This wording is relative to N4606.
Edit 23.3.9.5 [list.ops] p29 as indicated:
void sort(); template <class Compare> void sort(Compare comp);-28- Requires:
-29- Effects: Sorts the list according to theoperator<
(for the first version) orcomp
(for the second version) shall define a strict weak ordering (26.8 [alg.sorting]).operator<
or aCompare
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. […]