Report a bug
If you spot a problem with this page, click here to create a Github issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.
Functions and types that manipulate built-in arrays and associative arrays.
This module provides all kinds of functions to create, manipulate or convert arrays:
|array||Returns a copy of the input in a newly allocated dynamic array.|
Andrei Alexandrescu and Jonathan M Davis
if ((isInputRange!Range || isIterable!Range) && !isInfinite!Range && !isStaticArray!Range || isPointer!Range && isIterable!(PointerTarget!Range));
- Allocates an
arrayand initializes it with copies of the elements of range
r.Narrow strings are handled as a special case in an overload.Parameters:
range (or aggregate with opApply function) whose elements are copied into the allocated
arrayReturns:allocated and initialized
auto a = array([1, 2, 3, 4, 5]); assert(a == [ 1, 2, 3, 4, 5 ]);Examples:
assert("Hello D".array == "Hello D"); assert("Hello D"w.array == "Hello D"w); assert("Hello D"d.array == "Hello D"d);