The OpenD Programming Language

array

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

Narrow strings are handled as a special case in an overload.

array
(
Range
)
(
Range r
)
if (
(
isInputRange!Range ||
)
&&
!isInfinite!Range
&&
!__traits(isStaticArray, Range)
||
)

Parameters

r Range

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

Return Value

Type: auto

allocated and initialized array

Examples

auto a = array([1, 2, 3, 4, 5][]);
assert(a == [ 1, 2, 3, 4, 5 ]);
assert("Hello D".array == "Hello D");
assert("Hello D"w.array == "Hello D"w);
assert("Hello D"d.array == "Hello D"d);

Meta