The OpenD Programming Language

partialSort

Stores the smallest elements of the two ranges in the left-hand range in sorted order.

  1. void partialSort(Range r, size_t n)
  2. void partialSort(Range1 r1, Range2 r2)
    void
    partialSort
    (
    alias less = "a < b"
    Range1
    Range2
    )
    (
    Range1 r1
    ,
    Range2 r2
    )
    if (
    isRandomAccessRange!(Range1) &&
    hasLength!Range1
    &&
    &&
    is(ElementType!Range1 == ElementType!Range2)
    &&
    &&
    )

Parameters

less

The predicate to sort by.

ss

The swapping strategy to use.

r1 Range1

The first range.

r2 Range2

The second range.

Examples

int[] a = [5, 7, 2, 6, 7];
int[] b = [2, 1, 5, 6, 7, 3, 0];

partialSort(a, b);
assert(a == [0, 1, 2, 2, 3]);

Meta