DynamicArray

Array that is able to grow itself when items are appended to it. Uses malloc/free/realloc to manage its storage.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

AppendT
alias AppendT = const(T)

Either const(T) or T.

AppendT
alias AppendT = T
Undocumented in source.
AppendTypeOfThis
alias AppendTypeOfThis = const(typeof(this))

Either const(typeof(this)) or typeof(this).

AppendTypeOfThis
alias AppendTypeOfThis = typeof(this)
Undocumented in source.
insert
alias insert = insertBack
insertAnywhere
alias insertAnywhere = insertBack

Inserts the given value into the end of the array.

opDollar
alias opDollar = length
put
alias put = insertBack

Inserts the given value into the end of the array.

Functions

back
T back()
empty
bool empty()
front
T front()
insertBack
void insertBack(T value)

Inserts the given value into the end of the array.

length
size_t length()
opBinary
typeof(this) opBinary(AppendTypeOfThis other)
typeof(this) opBinary(AppendT[] values)

~ operator overload

opIndex
auto opIndex(size_t i)

Index operator overload

opIndexAssign
void opIndexAssign(T value, size_t i)

Index assignment support

opOpAssign
typeof(this) opOpAssign(T value)

~= operator overload

opOpAssign
typeof(this) opOpAssign(AppendT[] rhs)
typeof(this) opOpAssign(AppendTypeOfThis rhs)

~= operator overload for an array of items

opSlice
auto opSlice()
auto opSlice(size_t a, size_t b)

Slice operator overload

opSliceAssign
void opSliceAssign(T value)
void opSliceAssign(T value, size_t i, size_t j)

Slice assignment support

ptr
auto ptr()
remove
void remove(size_t i)

Remove the item at the given index from the array.

removeBack
void removeBack()

Removes the last element from the array.

reserve
void reserve(size_t n)

Ensures sufficient capacity to accommodate n elements.

resize
void resize(size_t n)

Change the array length. When growing, initialize new elements to the default value.

resize
void resize(size_t n, T value)

Change the array length. When growing, initialize new elements to the given value.

shrinkTo
void shrinkTo(size_t nl)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

allocator
Allocator allocator;
Undocumented in source.

Templates

stateSize
template stateSize(T)

Returns the size in bytes of the state that needs to be allocated to hold an object of type T. stateSize!T is zero for structs that are not nested and have no nonstatic member variables.

Parameters

T

the array element type

Allocator

the allocator to use. Defaults to Mallocator.

Meta