An array of T with I.length dimensions.
import std.algorithm.comparison : equal; import std.range : repeat; auto arr = minimallyInitializedArray!(int[])(42); assert(arr.length == 42); // Elements aren't necessarily initialized to 0, so don't do this: // assert(arr.equal(0.repeat(42))); // If that is needed, initialize the array normally instead: auto arr2 = new int[42]; assert(arr2.equal(0.repeat(42)));
Returns a new array of type T allocated on the garbage collected heap.
Partial initialization is done for types with indirections, for preservation of memory safety. Note that elements will only be initialized to 0, but not necessarily the element type's .init.
minimallyInitializedArray is nothrow and weakly pure.