unshift

Pops an elemens from a given index in the slice.

Basically a macro for

T temp = slice[index];
slice[index .. $].shiftLeft(1);
return temp;
T
unshift
(
T
)
(
T[] slice
,
size_t index
)

Examples

static int[] a = [ 1, 2, 3, 4 ];
int extracted = a.unshift(2);
assert(extracted == 3);
assert(a[0] == 1); assert(a[1] == 2); assert(a[2] == 4);