List.popFront

Pop the last element of the bidirectional list, effectively reducing its length by 1.

Return erased element.

  1. auto popFront()
    struct List
    scope nothrow
    popFront
    (
    T = Unqual!ElementType
    )
    ()
    if (
    is(T == Unqual!ElementType) ||
    is(T == void)
    )
  2. ElementType popFront(ElementType def)

Examples

List!(int) list = List!(int).build(30, 20, 10);
assert(list.length == 3);

assert(list.popFront == 30);
assert(list.length == 2);

assert(list.popFront == 20);
assert(list.length == 1);

assert(list.popFront == 10);
assert(list.empty);

assert(list.popFront(int.init) == int.init);
assert(list.empty);

assert(list.popFront(42) == 42);
assert(list.empty);

Meta