make

Constructs a new array with n elements.

  1. T make(Allocator allocator, A args)
  2. T* make(Allocator allocator, A args)
  3. T make(Allocator allocator, size_t n)
    T
    make
    (
    T : E[]
    E
    )
    (,
    size_t n
    )

Parameters

T

Array type.

E

Array element type.

allocator Allocator

Allocator.

n size_t

Array size.

Return Value

Type: T

Newly created array.

Precondition: allocator !is null && n <= size_t.max / E.sizeof

Examples

int[] i = defaultAllocator.make!(int[])(2);
assert(i.length == 2);
assert(i[0] == int.init && i[1] == int.init);
defaultAllocator.dispose(i);

Meta