makeArray

fnT[] makeArray(T, Allocator)(auto ref Allocator alloc, size_t length)

Create an array of T with length elements using alloc. The array is either default-initialized, filled with copies of init, or initialized with values fetched from range.

Parameters

Telement type of the array being created
allocthe allocator used for getting memory
lengthlength of the newly created array
initelement used for filling the array
rangerange used for initializing the array elements

Returns

The newly-created array, or null if either length was 0 or

allocation failed.

Throws

The first two overloads throw only if alloc's primitives do. The

overloads that involve copy initialization deallocate memory and propagate the exception if the copy operation throws.

fnT[] makeArray(T, Allocator)(auto ref Allocator alloc, size_t length, T init)

Ditto

fnUnqual!(ElementEncodingType!R)[] makeArray(Allocator, R)(auto ref Allocator alloc, R range) if (isInputRange!R && !isInfinite!R)

Ditto

fnT[] makeArray(T, Allocator, R)(auto ref Allocator alloc, R range) if (isInputRange!R && !isInfinite!R)

Ditto