Types
StaticDeque[N; T] = object
-
This is similar to std/deques, but has fixed size storage that can be allocated on stack.
This has an array to hold 2^N elements.
Procs
proc `[]`(x: StaticDeque; i: Natural): lent x.T {.inline.}
-
Accesses the i-th element of deq.
Example:
var a: StaticDeque[2, int] a.addLast 10 a.addLast 20 a.addLast 30 a.addLast 40 assert a[0] == 10 assert a[3] == 40 doAssertRaises(IndexDefect, echo a[8])
proc `[]`(x: var StaticDeque; i: Natural): var x.T {.inline.}
-
Accesses the i-th element of deq and returns a mutable reference to it.
Example:
var a: StaticDeque[2, int] a.addLast 10 inc(a[0]) assert a[0] == 11
proc addLast(x: var StaticDeque; item: sink x.T)
func high(x: StaticDeque): int
func isFull(x: StaticDeque): bool
func len(x: StaticDeque): int
func maxLen(T: typedesc[StaticDeque]): int {.compileTime.}
proc popFirst(x: var StaticDeque): x.T {.inline, discardable.}
Iterators
iterator items(x: StaticDeque): x.T
iterator mitems(x: var StaticDeque): var x.T
Templates
template maxLen(x: StaticDeque): int