Module queues

Implementation of a queue. The underlying implementation uses a seq.

Types

TQueue* {.pure, final.}[T] = object 
  data: seq[T]
  rd, wr, count, mask: int
a queue

Procs

proc initQueue*[T](initialSize = 4): TQueue[T]
creates a new queue. initialSize needs to be a power of 2.
proc len*[T](q: TQueue[T]): int
returns the number of elements of q.
proc add*[T](q: var TQueue[T]; item: T)
adds an item to the end of the queue q.
proc enqueue*[T](q: var TQueue[T]; item: T)
alias for the add operation.
proc dequeue*[T](q: var TQueue[T]): T
removes and returns the first element of the queue q.
proc `$`*[T](q: TQueue[T]): string
turns a queue into its string representation.

Iterators

iterator items*[T](q: TQueue[T]): T
yields every element of q.
Generated: 2012-09-23 21:47:54 UTC