Use std::partition.