DList.removeFront

Removes howMany elements from the list.

Unlike $(D_PSYMBOL removeFront()) and $(D_PSYMBOL removeBack()), 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 DList(T)
    size_t
    removeFront
    (
    size_t howMany
    )
    out (removed) { assert (removed <= howMany); }
  3. size_t removeBack(size_t howMany)

Parameters

howMany size_t

How many elements should be removed.

Return Value

Type: size_t

The number of elements removed.

Examples

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

assert(l.removeFront(0) == 0);
assert(l.removeFront(2) == 2);
assert(l.removeFront(3) == 1);
assert(l.removeFront(3) == 0);
DList!int l = DList!int([8, 5, 4]);

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

Meta