Partition
C++ offers a few functions for dealing with partitions. All of them need a unary predicate pre
. std::partition
and std::stable_partition
partition a range and returns the partition point. With std::partition_point
you can get the partition point of a partition. Afterwards you can check the partition with std::is_partitioned
or copy it with std::partition_copy
.
Checks if the range is partitioned:
bool
is_partitioned
(
InpIt
first
,
InpIt
last
,
UnPre
pre
)
bool
is_partitioned
(
ExePol
pol
,
FwdIt
first
,
FwdIt
last
,
UnPre
pre
)
Partitions the range:
FwdIt
partition
(
FwdIt
first
,
FwdIt
last
,
UnPre
pre
)
FwdIt
partition
(
ExePol
pol
,
FwdIt
first
,
FwdIt
last
,
UnPre
pre
...