SList.removeFront

Removes howMany elements from the list.

Unlike $(D_PSYMBOL removeFront()), this method doesn't fail, if it could not remove howMany elements. Instead, if howMany is greater than the list length, all elements are removed.

  1. void removeFront()
  2. size_t removeFront(size_t howMany)
    struct SList(T)
    size_t
    removeFront
    (
    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

SList!int l = SList!int([8, 5, 4]);

assert(l.removeFront(0) == 0);
assert(l.removeFront(2) == 2);
assert(l.removeFront(3) == 1);
assert(l.removeFront(3) == 0);

Meta