Array.removeBack

Remove n of elements from the end.

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

Return Value

Type: uint

number of removed elements.

Examples

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

arr.insertBack([1,2,3]);
assert(arr.removeBack(3) == 3);
assert(arr.length == 0);

arr.insertBack([1,2,3,4]);
assert(arr.removeBack(2) == 2);
assert(arr.data == [1,2]);

assert(arr.removeBack(3) == 2);
assert(arr.length == 0);

Meta