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)

Push a series of values onto the stack.

clear
Stack* clear()

Clear the stack

clone
Stack clone()

Returns a (shallow) clone of this stack, on the stack

nth
V nth(size_t i)

Index stack entries, where a zero index represents the newest stack entry (the top).

opApply
int opApply(int delegate(ref V value) dg)

Iterate from the most recent to the oldest stack entries

opOpAssign
Stack* opOpAssign(uint d)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Stack* opOpAssign(uint d)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Stack* opOpAssign(V value)
Undocumented in source. Be warned that the author may not have intended to support it.
pop
V pop()

Remove and return the most recent addition to the stack.

push
Stack* push(V value)

Push a value onto the stack.

rotateLeft
Stack* rotateLeft(size_t d)

Rotate the given number of stack entries

rotateRight
Stack* rotateRight(size_t d)

Rotate the given number of stack entries

slice
V[] slice()

Return the stack as an array of values, where the first array entry represents the oldest value.

swap
V swap()

Swaps the top two entries, and return the top

unused
size_t unused()

Return remaining unused slots

Properties

dup
V dup [@property getter]

Push and return a (shallow) copy of the topmost element

size
size_t size [@property getter]

Return depth of the stack

top
V top [@property getter]

Return the most recent addition to the stack.

Meta