Syntax:
#include <algorithm> void stable_sort( random_access_iterator start, random_access_iterator end ); void stable_sort( random_access_iterator start, random_access_iterator end, StrictWeakOrdering cmp );
The stable_sort() algorithm is like the sort() algorithm, in that it sorts a range of elements into ascending order. Unlike sort(), however, stable_sort() will preserve the original ordering of elements that are equal to each other.
todo
todo
This functionality comes at a small cost, however, as stable_sort() takes more comparisons that sort() in the worst case: N (log N)^2 instead of N log N.