#include <algorithm> template< class BidirectionalIterator, class UnaryPredicate > BidirectionalIterator stable_partition( BidirectionalIterator first, BidirectionalIterator last, UnaryPredicate p );
Reorders the elements in the range [first, last)
in such a way that all elements for which the predicate p
returns true precede the elements for which predicate p
returns false
. Relative order of the elements is preserved.
first
, last
- the range to be reordered
p
- unary predicate
iterator to the first element of the second group
linear in distance between first
and last