Queue

Simple queue implemented as a singly linked list with a tail pointer.

Needed in some D:YAML code that needs a queue-like structure without too much reallocation that goes with an array.

This should be replaced once Phobos has a decent queue/linked list.

Uses manual allocation through malloc/free.

Also has some features uncommon for a queue, e.g. iteration. Couldn't bother with implementing a range, as this is used only as a placeholder until Phobos gets a decent replacement.

Destructor

~this
~this()

Destroy the queue, deallocating all its elements.

Members

Functions

empty
bool empty()

Is the queue empty?

insert
void insert(T item, size_t idx)

Insert a new item putting it to specified index in the linked list.

iterationOver
bool iterationOver()

Are we done iterating?

length
size_t length()

Return number of elements in the queue.

next
const(T) next()

Get next element in the queue.

opAssign
void opAssign(Queue )
Undocumented in source.
opCmp
int opCmp(Queue )
Undocumented in source.
opEquals
bool opEquals(Queue )
Undocumented in source.
peek
inout(T) peek()

Return the next element in the queue.

pop
T pop()

Return the next element in the queue and remove it.

push
void push(T item)

Push new item to the queue.

startIteration
void startIteration()

Start iterating over the queue.

Meta