C++ Standard Library partition() Sample

Description

partition() does a weak form of sorting of a sequence of elements, such that every element that satisfies a user-defined predicate is placed before every element that does not.

Declaration

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

Concept

The sample program sets up a vector, and then partitions it such that all the negative values will appear before all the positive ones. No particular ordering within the negative or positive values is preserved.

Special Notes:

stable_partition() maintains relative ordering.

Supported
Supported
Supported