Queue

Queue implementation based on Array.

Members

Functions

dequeue
T dequeue()

Remove element from queue.

dequeue
bool dequeue(T value)

Non-throwing version of dequeue.

enqueue
void enqueue(const(T) v)

Add element to queue.

free
void free()

Free memory allocated by Queue.

Properties

empty
bool empty [@property getter]

Check if stack has no elements.

Examples

import std.exception: assertThrown;

Queue!int q;
assertThrown(q.dequeue());
assert (q.empty);

q.enqueue(50);
q.enqueue(30);
q.enqueue(900);

int v;
q.dequeue(v);
assert (v == 50);
assert (q.dequeue() == 30);
assert (q.dequeue() == 900);
assert (q.empty);

q.free();

Meta