Array.shiftLeft

Shift contents of array to the left by n positions. Does not change the size of array. n of last elements becomes default initialized.

struct Array(T, size_t chunkSize = 32)
void
shiftLeft
(
const(uint) n
)

Examples

Array!int arr;
scope(exit) arr.free();

arr.shiftLeft(1);
assert(arr.length == 0);

arr.insertBack([1,2,3,4,5]);

arr.shiftLeft(2);
assert(arr.length == 5);
assert(arr[0] == 3);
assert(arr[1] == 4);
assert(arr[2] == 5);
assert(arr[3] == int.init);
assert(arr[4] == int.init);

Meta