sort

Sorts buf using the supplied predicate or '<' if none is supplied. The algorithm is not required to be stable. The current implementation is based on quicksort, but uses a three-way partitioning scheme to improve performance for ranges containing duplicate values (Bentley and McIlroy, 1993).

  1. void sort(Elem[] buf, Pred2E pred)
    version(TangoDoc)
    void
    sort
    (
    Elem
    Pred2E = IsLess!(Elem)
    )
    (
    Elem[] buf
    ,
    Pred2E pred = Pred2E.init
    )
  2. template sort(Buf)
  3. template sort(Buf, Pred)

Parameters

buf Elem[]

The array to sort. This parameter is not marked 'ref' to allow temporary slices to be sorted. As buf is not resized in any way, omitting the 'ref' qualifier has no effect on the result of this operation, even though it may be viewed as a side-effect.

pred Pred2E

The evaluation predicate, which should return true if e1 is less than e2 and false if not. This predicate may be any callable type.

Meta