alloc

Allocate the array using malloc

version(Windows)
void
alloc
(
T
intT
)
(
ref T array
,,
bool init = true
)
out { assert (numItems == array.length); }

Parameters

array T

the array which will be resized

numItems intT

number of items to be allocated in the array

init bool

whether to init the allocated items to their default values or not

Examples

int[] foo;
foo.alloc(20);

Remarks: The array must be null and empty for this function to succeed. The rationale behind this is that the coder should state his decision clearly. This will help and has already helped to spot many intricate bugs.

Meta