Function std.algorithm.sorting.partition
Partitions a range in two using the given predicate.
Specifically, reorders the range r = [left, rightclass="pln">RPAREN using swap
such that all elements i for which predicate(i) is true come
before all elements j for which predicate(j) returns false.
						
				Range partition(alias predicate, SwapStrategy ss, Range)
				(
				
				  Range r
				
				)
				
				if (ss == SwapStrategy
				
				Range partition(alias predicate, SwapStrategy ss = SwapStrategy
				  Range r
				
				)
				
				if (ss != SwapStrategy
				Performs Ο(r) (if unstable or semistable) or Ο(r) (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
| Name | Description | 
|---|---|
| predicate | The predicate to partition by. | 
| ss | The swapping strategy to employ. | 
| r | The random-access range to partition. | 
Returns
The right part of r after partitioning.
If ss == SwapStrategy, partition preserves the relative
ordering of all elements a, b in r for which `predicate(a) =$D(
predicate(b)). If ss == SwapStrategy, partition preserves
the relative ordering of all elements a, b in the left part of r
for which predicate(a) == predicate(b).
Example
import std