C++ Standard Library partial_sort() Sample

Description

partial_sort() does a partial sorting of a sequence of elements, putting the first few elements into sorted order. This is useful if you only need the first sorted elements.

Declaration

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

Concept

The sample sets up an unsorted vector, and then sorts it such that the five smallest values are moved to the front of the vector. The rest of the vector is not sorted.

Supported
Supported
Supported