mergeSort

Merge sort. O(N log N) time, O(N) space, small constant. Stable sort. If last argument is a ulong* instead of an array-like type, the dereference of the ulong* will be incremented by the bubble sort distance between the input array and the sorted version. This is useful in some statistics functions such as Kendall's tau.

T[0]
mergeSort
(
alias compFun = "a < b"
T...
)
()
if (
T.length != 0
)
in { assert (data.length > 0); size_t len = data[0].length; foreach (array; data[1 .. $]) { static if (!is(typeof(array) == ulong*)) assert (array.length == len); } }

Meta