The OpenD Programming Language

array

Allocates an array and initializes it with copies of the elements of range r.

Narrow strings are handled as follows: - If autodecoding is turned on (default), then they are handled as a separate overload. - If autodecoding is turned off, then this is equivalent to duplicating the array.

  1. ForeachType!Range[] array(Range r)
  2. ForeachType!(typeof((*Range).init))[] array(Range r)
    ForeachType!(typeof((*Range).init))[]
    array
    (
    Range
    )
    (
    Range r
    )
    if (
    is(Range == U*,
    U
    ) &&
    &&
    &&
    !isInfinite!Range
    )
  3. CopyTypeQualifiers!(ElementType!String, dchar)[] array(String str)

Parameters

r Range

range (or aggregate with opApply function) whose elements are copied into the allocated array

Return Value

Type: ForeachType!(typeof((*Range).init))[]

allocated and initialized array

Examples

auto a = array([1, 2, 3, 4, 5][]);
assert(a == [ 1, 2, 3, 4, 5 ]);

Meta