C++ Standard Library stable_sort() Sample

Description

stable_sort() sorts a sequence of elements, using the builtin operator < or a user-defined comparison function. Unlike sort(), it is stable, that is, the relative order of equal elements is preserved by the sorting process.

Declaration

	template <class Ran>
	    void stable_sort(Ran, Ran);
	template <class Ran, class Cmp>
	    void stable_sort(Ran, Ran, Cmp);

Concept

The sample program sets up a vector of records and sorts them. Records that compare equal according to the supplied ordering function are kept in the order that they appeared in the input. Output of the program is:

	-5,12
	-5,13
	12,19
	12,3
	17,4

Supported
Supported
Supported