popFront

$(D_PSYMBOL popFront) and $(D_PSYMBOL popBack) advance the array and remove one element from its back, respectively.

$(D_PSYMBOL popFront) and $(D_PSYMBOL popBack) don't alter the array storage, they only narrow the view into the array.

  1. void popFront(inout(T)[] array)
    void
    popFront
    (
    T
    )
    (
    ref inout(T)[] array
    )
  2. void popBack(inout(T)[] array)

Parameters

T

Element type of array.

array inout(T)[]

Built-in array.

Precondition: array.length > 0.

Examples

wstring array = "Der finstere Ozean der Metaphysik. Nietzsche";

array.popFront();
assert(array.length == 43);
assert(array.front == 'e');

array.popBack();
assert(array.length == 42);
assert(array.back == 'h');

Meta