 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Prateek Guest
|
Posted: Tue Apr 12, 2005 7:00 pm Post subject: Std. doesn't seem to require stable_sort() to be stable! |
|
|
<quote>
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.
</quote>
So this means that a "Notes" paragraph wouldn't be normative.
<quote>
25.3.1.2 stable_sort
template<class RandomAccessIterator>
void stable_sort(RandomAccessIterator first, RandomAccessIterator
last);
template<class RandomAccessIterator, class Compare>
void stable_sort(RandomAccessIterator 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.
</quote>
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?
Prateek Karandikar
-- --
To iterate is human, to recurse divine. -L. Peter Deutsch
-- --
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|