Array.this

Constructs a qualified array out of a number of items. Because no allocator was provided, the array will use the GCAllocator.std.experimental.allocator.gc_allocator..

  1. this(A allocator)
  2. this(U[] values)
    struct Array(T)
    this
    (
    U
    this Q
    )
    ()
    if (
    isImplicitlyConvertible!(U, T)
    )
  3. this(A allocator, U[] values)
  4. this(Stuff stuff)
  5. this(A allocator, Stuff stuff)

Parameters

values U[]

a variable number of items, either in the form of a list or as a built-in array

Complexity: O(m), where m is the number of items.

Examples

import std.algorithm.comparison : equal;

// Create a list from a list of ints
{
    auto a = Array!int(1, 2, 3);
    assert(equal(a, [1, 2, 3]));
}
// Create a list from an array of ints
{
    auto a = Array!int([1, 2, 3]);
    assert(equal(a, [1, 2, 3]));
}
// Create a list from a list from an input range
{
    auto a = Array!int(1, 2, 3);
    auto a2 = Array!int(a);
    assert(equal(a2, [1, 2, 3]));
}

Meta