The OpenD Programming Language

rcseries

Constructs a RC-allocated series from an associative array. Performs exactly two allocations.

  1. auto rcseries(RV[RK] aa)
  2. auto rcseries(V[K] aa)
    rcseries
    (
    K
    V
    RK = const K
    RV = const V
    )
    (
    const V[K] aa
    )
    if (
    is(typeof(K.init < K.init)) &&
    is(typeof(Unqual!K.init < Unqual!K.init))
    )
  3. auto rcseries(V[K] aa)
  4. auto rcseries(V[K]* aa)

Parameters

aa V[K]

associative array or a pointer to associative array

Return Value

Type: auto

sorted RC-allocated series.

Examples

auto s = [1: 1.5, 3: 3.3, 2: 20.9].rcseries;
assert(s.index == [1, 2, 3]);
assert(s.data == [1.5, 20.9, 3.3]);
assert(s.data[s.findIndex(2)] == 20.9);

See Also

Meta