View source code
Display the source code in std/algorithm/sorting.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.algorithm.sorting.completeSort
Sorts the random-access range chain(
according to
predicate lhs
, rhs
)less
. The left-hand side of the range
is
assumed to be already sorted; lhs
is assumed to be unsorted. The
exact strategy chosen depends on the relative sizes of rhs
and
lhs
. Performs Ο(rhs
lhs.length + rhs.length * log(rhs.length)
)
(best case) to Ο((lhs.length + rhs.length) * log(lhs.length +
rhs.length)
) (worst-case) evaluations of swap
.
Prototype
void completeSort(alias less, std.algorithm.mutation.SwapStrategy ss, Range1, Range2)( SortedRange!(Range1,less) lhs, Range2 rhs ) if (hasLength!Range2 && hasSlicing!Range2);
Example
import std.range : assumeSorted; int[] a = [ 1, 2, 3 ]; int[] b = [ 4, 0, 6, 5 ]; completeSort(assumeSorted(a), b); assert(a == [ 0, 1, 2 ]); assert(b == [ 3, 4, 5, 6 ]);