dyaml.queue

struct Queue

Types 1

structQueue(T) if (!hasMember!(T, "__xdtor"))

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.

Allocations are non-GC and are damped by a free-list based on the nodes that are removed. Note that elements lifetime must be managed outside.

Fields
Node * first_
Node * last_
Node * stock
size_t length_
Methods
Node * makeNewNode(T thePayload, Node * theNext = null) @trusted nothrow @nogc
void freeStock() @trusted @nogc nothrow
void opAssign(ref Queue) @disable
bool opEquals(ref Queue) @disable
int opCmp(ref Queue) @disable
auto range() @safe pure nothrow @nogcReturns a forward range iterating over this queue.
void push(T item) @nogc @safe nothrowPush a new item to the queue.
void insert(T item, const size_t idx) @safe nothrowInsert a new item putting it to specified index in the linked list.
T pop() @safe nothrowReturns: The next element in the queue and remove it.
inout(T) peek() ref @safe pure nothrow inout @nogcReturns: The next element in the queue.
bool empty() @safe pure nothrow const @nogcReturns: true of the queue empty, false otherwise.
size_t length() @safe pure nothrow const @nogcReturns: The number of elements in the queue.
Destructors
Nested Templates
Node