expandArray

fnbool expandArray(T, Allocator)(auto ref Allocator alloc, ref T[] array, size_t delta)

Grows array by appending delta more elements. The needed memory is allocated using alloc. The extra elements added are 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
arraya reference to the array being grown
deltanumber of elements to add (upon success the new length of array is array.length + delta)
initelement used for filling the array
rangerange used for initializing the array elements

Returns

true upon success, false if memory could not be allocated. In the

latter case array is left unaffected.

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.

fnbool expandArray(T, Allocator)(auto ref Allocator alloc, ref T[] array, size_t delta, auto ref T init)

Ditto

fnbool expandArray(T, Allocator, R)(auto ref Allocator alloc, ref T[] array, R range) if (isInputRange!R)

Ditto