Title
Std. doesn't seem to require stable_sort() to be stable!
Status
nad editorial
Section
[stable.sort]
Submitter
Prateek Karandikar

Created on 2005-04-12.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

This change has already been made.

Date: 2005-04-12.00:00:00

17.3.1.1 Summary

1 The Summary provides a synopsis of the category, and introduces the first-level subclauses. Each subclause also provides a summary, listing the headers specified in the subclause and the library entities provided in each header.

2 Paragraphs labelled "Note(s):" or "Example(s):" are informative, other paragraphs are normative.

So this means that a "Notes" paragraph wouldn't be normative.

25.3.1.2 stable_sort

template<class RandomAccessIterator> 
void stable_sort(RandomAccessIterat or first, RandomAccessIterator last); 

template<class RandomAccessIterator, class Compare> 
void stable_sort(RandomAccessIterat or first, RandomAccessIterator last, Compare comp);

1 Effects: Sorts the elements in the range [first, last).

2 Complexity: It does at most N(log N)^2 (where N == last - first) comparisons; if enough extra memory is available, it is N log N.

3 Notes: Stable: the relative order of the equivalent elements is preserved.

The Notes para is informative, and nowhere else is stability mentioned above.

Also, I just searched for the word "stable" in my copy of the Standard. and the phrase "Notes: Stable: the relative order of the elements..." is repeated several times in the Standard library clauses for describing various functions. How is it that stability is talked about in the informative paragraph? Or am I missing something obvious?

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg2857
2005-04-12 00:00:00admincreate