FIFOStack

A FIFO (First In is First Out, first element pushed will be removed first) stack

Constructors

this
this()

constructor

Destructor

~this
~this()

destructor

Members

Functions

clear
void clear()

clears the whole stack, pops all items

pop
T pop()

pops an item from the stack (from bottom of stack, since it's a FIFO stack)

pop
T[] pop(uinteger popCount)

pops a number of items from the stack (from bottom since it's a FIFO Stack)

push
void push(T element)

pushes an element to stack

push
void push(T[] elements)

pushes an array of elements to stack

Properties

count
uinteger count [@property getter]

Examples

FIFOStack!int stack = new FIFOStack!int;
stack.push(0);
stack.push([1,2,3,4]);
assert(stack.count == 5);
assert(stack.pop == 0);
assert(stack.count == 4);
assert(stack.pop(2) == [1,2]);
assert(stack.count == 2);
assert(stack.pop(2) == [3,4]);
assert(stack.count == 0);
stack.push([0,1,2]);
assert(stack.count == 3);
assert(stack.pop(3) == [0,1,2]);

Meta