View source code
Display the source code in std/algorithm/sorting.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
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.
Function std.algorithm.sorting.completeSort
Sorts the random-access range chain(lhs, rhs)
according to
predicate less
. The left-hand side of the range lhs
is
assumed to be already sorted; rhs
is assumed to be unsorted. The
exact strategy chosen depends on the relative sizes of lhs
and
rhs
. Performs Ο(lhs
)
(best case) to Ο((lhs
) (worst-case) evaluations of swap
.
void completeSort(alias less, SwapStrategy ss = SwapStrategy .unstable, Lhs, Rhs)
(
SortedRange!(Lhs,less) lhs,
Rhs rhs
)
if (hasLength!Rhs && hasSlicing!Rhs && hasSwappableElements!Lhs && hasSwappableElements!Rhs);
Parameters
Name | Description |
---|---|
less | The predicate to sort by. |
ss | The swapping strategy to use. |
lhs | The sorted, left-hand side of the random access range to be sorted. |
rhs | The unsorted, right-hand side of the random access range to be sorted. |
Example
import std .range : assumeSorted;
int[] a = [ 1, 2, 3 ];
int[] b = [ 4, 0, 6, 5 ];
completeSort(assumeSorted(a), b);
writeln(a); // [0, 1, 2]
writeln(b); // [3, 4, 5, 6]
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.