cpp/algorithm/ranges/stable partition

@1@ Reorders the elements in the range in such a way that the projection  of all elements for which the predicate  returns  precede the projection  of elements for which predicate  returns. The algorithms is stable, i.e. the relative order of elements is preserved.

@2@ Same as, but uses as the range, as if using  as  and  as.

Return value
@1@ An object equal to, where is an iterator to the first element of the second group. @2@ Same as if  is an lvalue or of a  type. Otherwise returns std.

Complexity
Given, the complexity is at worst swaps, and only  swaps in case an extra memory buffer is used. Exactly applications of the predicate  and projection.

Possible implementation
This implementation does not use extra memory buffer and as such can be less efficient. See also the implementation in MSVC STL and libstdc++.