I couldn't find any definitive answer to this question.
I suppose most implementation use merge sort that is stable but, is the stability a requirement or a side effect?
I couldn't find any definitive answer to this question.
I suppose most implementation use merge sort that is stable but, is the stability a requirement or a side effect?
According to "The C++ Programming Language" (Stroustrup p470), yes, stl::list<>::sort is stable.
C++ Standard ISO/IEC 14882:2003 says:
23.2.2.4/31
Notes: Stable: the relative order of the equivalent elements is preserved. If an exception is thrown the order of the elements in the list is indeterminate.