The OpenD Programming Language

rankSort

Same as rank(), but also sorts the input range. The array returned will still be identical to that returned by rank(), i.e. the rank of each element will correspond to the ranks of the elements in the input array before sorting.

Ret[]
rankSort
(
alias compFun = "a < b"
Ret = double
T
)
(,
Ret[] buf = null
)
if (
is(typeof(input.front < input.front))
)

Examples

uint[] test = [3, 5, 3, 1, 2];
assert(rankSort(test) == [3.5, 5, 3.5, 1.0, 2.0]);
assert(test == [1U, 2, 3, 4, 5]);

Meta