stableSort

Stable Variant of Quick Sort.

ref pure
stableSort
(
T
)
(
auto ref T a
)
if (
isRandomAccessRange!T
)

Examples

import nxt.random_ex : randInPlace;
immutable n = 2^^16;
auto a = new int[n];
a.randInPlace();
auto b = a.dup;
a[].stableSort;
import std.algorithm: sort;
sort(b);
assert(a == b);

See Also

Meta