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.
element type of the array being created
the allocator used for getting memory
a reference to the array being grown
number of elements to add (upon success the new length of array is array.length + delta)
true upon success, false if memory could not be allocated. In the latter case array is left unaffected.
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.
1 auto arr = theAllocator.makeArray!int([1, 2, 3]); 2 assert(theAllocator.expandArray(arr, 2)); 3 assert(arr == [1, 2, 3, 0, 0]); 4 import std.range : only; 5 assert(theAllocator.expandArray(arr, only(4, 5))); 6 assert(arr == [1, 2, 3, 0, 0, 4, 5]);