popBack

Implements the range interface primitive popBack for built-in arrays. Due to the fact that nonmember functions can be called with the first argument using the dot notation, array.popBack is equivalent to popBack(array). For narrow strings, popFront automatically eliminates the last code point.

  1. void popBack(inout(T)[] a)
    @safe pure nothrow @nogc
    void
    popBack
    (
    T
    )
    (
    scope ref inout(T)[] a
    )
    if (
    !is(T[] == void[])
    )
  2. void popBack(inout(T)[] a)

Examples

auto a = [ 1, 2, 3 ];
a.popBack();
assert(a == [ 1, 2 ]);

Meta

Suggestion Box / Bug Report