Array.removeBack

Removes howMany elements from the array.

This method doesn't fail if it could not remove howMany elements. Instead, if howMany is greater than the array length, all elements are removed.

  1. void removeBack()
  2. size_t removeBack(size_t howMany)
    struct Array(T)
    size_t
    removeBack
    (
    size_t howMany
    )
    out (removed) { assert (removed <= howMany); }

Parameters

howMany size_t

How many elements should be removed.

Return Value

Type: size_t

The number of elements removed

Examples

auto v = Array!int([5, 18, 17]);

assert(v.removeBack(0) == 0);
assert(v.removeBack(2) == 2);
assert(v.removeBack(3) == 1);
assert(v.removeBack(3) == 0);

Meta