partition

fnRange partition(alias predicate, SwapStrategy ss, Range)(Range r) if (ss == SwapStrategy.stable && isRandomAccessRange!(Range) && hasLength!Range && hasSlicing!Range && hasSwappableElements!Range)

Partitions a range in two using the given predicate.

Specifically, reorders the range r = [left, right) using swap such that all elements i for which predicate(i) is true come before all elements j for which predicate(j) returns false.

Performs r.length (if unstable or semistable) or * log(r.length) (if stable) evaluations of less and swap. The unstable version computes the minimum possible evaluations of swap (roughly half of those performed by the semistable version).

Parameters

predicateThe predicate to partition by.
ssThe swapping strategy to employ.
rThe random-access range to partition.

Returns

The right part of r after partitioning.

If ss == SwapStrategy.stable, partition preserves the relative ordering of all elements a, b in r for which predicate(a) == predicate(b). If ss == SwapStrategy.semistable, partition preserves the relative ordering of all elements a, b in the left part of r for which predicate(a) == predicate(b).

fnRange partition(alias predicate, SwapStrategy ss = SwapStrategy.unstable, Range)(Range r) if (ss != SwapStrategy.stable && isInputRange!Range && hasSwappableElements!Range)

ditto