Daily bit(e) of C++ | std::partition, std::stable_partition
Daily bit(e) of C++ #206, The partition algorithms: std::partition and std::stable_partition.
The std::partition algorithm reorders elements of a range based on a predicate. Elements for which the predicate evaluates to true are all ordered before elements for which the predicate evaluates to false.
The stable version std::stable_partition also maintains the relative order of elements (within each partition).