tango.util.container.more.Stack
License:
BSD style:
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.
- Stack* clear();
- Clear the stack
- size_t size();
- Return depth of the stack
- size_t 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
- Stack* push(V value);
- Push a value onto the stack.
Throws an exception when the stack is full
- Stack* 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(size_t 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
- Stack* rotateLeft(size_t d);
- Rotate the given number of stack entries
Throws an exception when the number is out of range
- Stack* rotateRight(size_t 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);
- Throw an exception
- int opApply(scope int delegate(ref V value) dg);
- Iterate from the most recent to the oldest stack entries
Page generated by Ddoc. Copyright (c) 2008 Kris Bell. All rights reserved