resizeArray

bool
resizeArray
(
T
)
(,
ref T[] array
,
in size_t length
)

Parameters

T

Element type of the array being created.

allocator Allocator

The allocator used for getting memory.

array T[]

A reference to the array being changed.

length size_t

New array length.

Return Value

Type: bool

$(D_KEYWORD true) upon success, $(D_KEYWORD false) if memory could not be reallocated. In the latter

Examples

int[] p;

defaultAllocator.resizeArray(p, 20);
assert(p.length == 20);

defaultAllocator.resizeArray(p, 30);
assert(p.length == 30);

defaultAllocator.resizeArray(p, 10);
assert(p.length == 10);

defaultAllocator.resizeArray(p, 0);
assert(p is null);

Meta