tango.util.container.more.Stack

License:

BSD style: see license.txt

Version:

Initial release: April 2008

Author:

Kris

Since:

0.99.7
struct Stack(V, int Size = 0) #
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.
void clear() #
Clear the stack
uint size() #
Return depth of the stack
uint unused() #
Return remaining unused slots
Stack clone() #
Returns a (shallow) clone of this stack, on the stack
V dup() #
Push and return a (shallow) copy of the topmost element
void push(V value) #
Push a value onto the stack.
Throws an exception when the stack is full
void append(V[] value...) #
Push a series of values onto the stack.
Throws an exception when the stack is full
V pop() #
Remove and return the most recent addition to the stack.
Throws an exception when the stack is empty
V top() #
Return the most recent addition to the stack.
Throws an exception when the stack is empty
V swap() #
Swaps the top two entries, and return the top
Throws an exception when the stack has insufficient entries
V nth(uint i) #
Index stack entries, where a zero index represents the newest stack entry (the top).
Throws an exception when the given index is out of range
void rotateLeft(uint d) #
Rotate the given number of stack entries
Throws an exception when the number is out of range
void rotateRight(uint d) #
Rotate the given number of stack entries
Throws an exception when the number is out of range
V[] slice() #
Return the stack as an array of values, where the first array entry represents the oldest value. Doing a foreach() on the returned array will traverse in the opposite direction of foreach() upon a stack
V error(size_t line) [private] #
Throw an exception
int opApply(int delegate(ref V value) dg) #
Iterate from the most recent to the oldest stack entries