The OpenD Programming Language

CyclicBuffer

Array that provides constant time (amortized) appending and popping at either end, as well as random access to the elements.

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
insertAnywhere
alias insertAnywhere = insertBack

Inserts the given item into the end of the buffer.

opDollar
alias opDollar = length
popBack
alias popBack = removeBack

Removes the item at the end of the buffer.

popFront
alias popFront = removeFront

Removes the item at the start of the buffer.

put
alias put = insertBack

Inserts the given item into the end of the buffer.

Functions

back
auto ref back()

Accesses to the item at the end of the buffer.

capacity
size_t capacity()
clear
void clear()

Removes all contents from the buffer.

empty
bool empty()
front
auto ref front()

Accesses to the item at the start of the buffer.

insertBack
void insertBack(U value)

Inserts the given item into the end of the buffer.

insertFront
void insertFront(U value)

Inserts the given item into the start of the buffer.

length
size_t length()
opIndex
auto ref opIndex(size_t i)

bufferi

opIndex
Range!This opIndex()

buffer[]

opIndex
Range!This opIndex(size_t[2] indices)

buffer[i .. j]

opSlice
size_t[2] opSlice(size_t i, size_t j)

buffer[i .. j]

removeBack
void removeBack()

Removes the item at the end of the buffer.

removeFront
void removeFront()

Removes the item at the start of the buffer.

reserve
size_t reserve(size_t newCapacity)

Ensures capacity is at least as large as specified.

Structs

Range
struct Range(ThisT)
Undocumented in source.

Parameters

T

the array element type

Allocator

the allocator to use. Defaults to Mallocator.

supportGC

true if the container should support holding references to GC-allocated memory.

Meta