Stack

A stack of the given value-type V, with maximum depth Size. Note that this does no memory allocation of its own when Size != 0, and does heap allocation when Size == 0. Thus you can have a fixed-size low-overhead instance, or a heap oriented instance.

Members

Aliases

opIndex
alias opIndex = nth
Undocumented in source.
opSlice
alias opSlice = slice
Undocumented in source.

Functions

append
Stack* append(V[] value)
clear
Stack* clear()

Clear the stack

clone
Stack clone()
dup
V dup()

Pushes shallow copy of topmost element

nth
V nth(uint i)
opApply
int opApply(int delegate(ref V value) dg)

Iterate from the most recent to the oldest stack entries

pop
V pop()

Removes most recent stack element

push
Stack* push(V value)
rotateLeft
Stack* rotateLeft(uint d)

Rotate the given number of stack entries

rotateRight
Stack* rotateRight(uint d)

Rotate the given number of stack entries

size
size_t size()
slice
V[] slice()
swap
V swap()

Swaps the top two entries

top
V top()
unused
size_t unused()

Templates

opOpAssign
template opOpAssign(string op : ">>")
Undocumented in source.
opOpAssign
template opOpAssign(string op : "<<")
Undocumented in source.
opOpAssign
template opOpAssign(string op : "~")
Undocumented in source.

Examples

Stack!(int) stack;
stack.push(42);
test!("==")(stack.pop(), 42);
testThrown!(StackBoundsException)(stack.pop());

Meta