The OpenD Programming Language

UnrolledList

Unrolled Linked List.

Nodes are (by default) sized to fit within a 64-byte cache line. The number of items stored per node can be read from the nodeCapacity field.

Constructors

this
this()

No default construction if an allocator must be provided.

this
this(Allocator allocator)

Use the given allocator for allocations.

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

A postblit is present on this object, but not explicitly documented in the source.

Members

Aliases

insert
alias insert = insertBack
put
alias put = insertBack

Inserts the given range into the end of the list

Functions

back
inout(T) back()

Time complexity is O(nodeCapacity), where the nodeCapacity is the number of items in a single list node. It is a constant related to the cache line size.

clear
void clear()

Removes all items from the list

empty
bool empty()
front
inout(T) front()

Time complexity is O(1)

insertAnywhere
T* insertAnywhere(T item)

Inserts the given item in the frontmost available cell, which may put the item anywhere in the list as removal may leave gaps in list nodes. Use this only if the order of elements is not important.

insertBack
T* insertBack(T item)

Inserts the given item into the end of the list.

insertBack
void insertBack(R range)

Inserts the given range into the end of the list

length
size_t length()
moveBack
T moveBack()

Removes an item from the back of the list and returns it.

moveFront
T moveFront()

Pops the front item off of the list and returns it

opOpAssign
T* opOpAssign(T item)

Inserts the given range into the end of the list

opSlice
auto opSlice()
popBack
void popBack()

Pops the back item off of the list.

popFront
void popFront()

Pops the front item off of the list

remove
bool remove(T item)

Removes the first instance of the given item from the list.

Parameters

T

the element type

Allocator

the allocator to use. Defaults to Mallocator.

supportGC

true to ensure that the GC scans the nodes of the unrolled list, false if you are sure that no references to GC-managed memory will be stored in this container.

cacheLineSize

Nodes will be sized to fit within this number of bytes.

See Also

Meta