List.popBack

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

Return erased element.

  1. auto popBack()
  2. auto popBack(ElementType def)
    struct List
    scope nothrow
    popBack
    (
    T : Unqual!ElementType = Unqual!ElementType
    )

Examples

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

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

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

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

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

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

Meta