mqueuecontainer.nim 258 B

1234567891011121314
  1. # original example used queues
  2. import deques
  3. type
  4. QueueContainer*[T] = object
  5. q: ref Deque[T]
  6. proc init*[T](c: var QueueContainer[T]) =
  7. new(c.q)
  8. c.q[] = initDeque[T](64)
  9. proc addToQ*[T](c: var QueueContainer[T], item: T) =
  10. c.q[].addLast(item)