pop

Removes and returns (via the 'popped' out parameter) the last element in an array. If the provided array is empty, the function returns false.

Template params: T = type of array element

  1. bool pop(Buffer!(T) buffer, T popped)
    bool
    pop
    (
    T
    )
    (
    ref Buffer!(T) buffer
    ,
    out T popped
    )
  2. bool pop(T[] array, T popped)

Parameters

buffer Buffer!(T)

buffer to pop an element from

popped T

popped element (if array contains > 0 elements)

Return Value

Type: bool

true if an element was popped

Examples

auto buffer = createBuffer("something");
char elem;
test(pop(buffer, elem));
test!("==")(buffer[], "somethin"[]);
test!("==")(elem, 'g');

Meta