Stack

A basic stack with push, and pop

Constructors

this
this()
Undocumented in source.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

clear
void clear()

Empties the stack, pops all items

pop
T[] pop(uinteger count)

Reads and removes an array of items from the stack,

pop
T pop()

pops an item from stack

push
void push(T item)

Appends an item to the stack

push
void push(T[] items)

Appends an array of items to the stack

Properties

count
uinteger count [@property getter]

Number of items in stack

Examples

Stack!ubyte stack = new Stack!ubyte;
//`Stack.push` and `Stack.pop`
stack.push(0);
stack.push([1, 2]);
assert(stack.pop == 2);
assert(stack.pop(2) == [1, 0]);
stack.push([1, 0]);
assert(stack.pop!(true)(2) == [1, 0]);
//`Stack.clear` && `Stack.count`
stack.push(0);
assert(stack.count == 1);
stack.clear;
assert(stack.count == 0);
stack.destroy;

Meta