C++ Standard Library stable_partition() Sample

Description

stable_partition() sorts a sequence of elements, such that all the elements that satisfy the user-supplied predicate are placed before all those that do not. Unlike partition(), stable_partition() preserves the relative ordering of elements.

Declaration

	template <class Bi, class Pred>
	    Bi stable_partition(Bi, Bi, Pred);

Concept

The sample program defines a vector of integers, and then partitions it. All the negative values will appear first, followed by the positive ones. The sets of negative and positive elements will appear in the same relative order that they did in the original sequence.

Supported
Supported
Supported