Array

GC-free dynamic array implementation. Very efficient for small-sized arrays.

Members

Aliases

append
alias append = insertBack
Undocumented in source.
appendLeft
alias appendLeft = insertFront
Undocumented in source.
insertAt
alias insertAt = insertKey
Undocumented in source.
opDollar
alias opDollar = length
Undocumented in source.
remove
alias remove = removeBack
Undocumented in source.
removeAt
alias removeAt = removeKey
Undocumented in source.
removeLeft
alias removeLeft = removeFront
Undocumented in source.

Functions

data
T[] data()

Get slice of data

free
void free()

Free dynamically allocated memory used by array.

insertBack
void insertBack(T c)

Append single element c to the end.

insertBack
void insertBack(const(T)[] s)

Append all elements of slice s to the end.

insertFront
void insertFront(T c)

Append element to the start.

insertFront
void insertFront(const(T)[] s)

Append all elements of slice s to the start.

insertKey
void insertKey(const(size_t) i, T v)

Inserts an element by a given index (resizing an array and shifting elements).

length
size_t length()

Get number of elements in array.

opApply
int opApply(int delegate(size_t i, ref T) dg)

Iterating over array via foreach.

opApply
int opApply(int delegate(ref T) dg)

Iterating over array via foreach.

opApplyReverse
int opApplyReverse(int delegate(size_t i, ref T) dg)

Iterating over array via foreach_reverse.

opApplyReverse
int opApplyReverse(int delegate(ref T) dg)

Iterating over array via foreach_reverse.

opIndex
T opIndex(const(size_t) index)

Access element by index.

opIndexAssign
T opIndexAssign(T t, const(size_t) index)

Set element t for index.

opOpAssign
auto opOpAssign(T c)

Same as insertBack, but in operator form.

opOpAssign
auto opOpAssign(const(T)[] s)

Same as insertBack, but in operator form.

opSlice
T[] opSlice(const(size_t) start, const(size_t) end)

Access by slice.

readOnlyData
const(T)[] readOnlyData()
Undocumented in source. Be warned that the author may not have intended to support it.
removeBack
uint removeBack(const(uint) n)

Remove n of elements from the end.

removeFirst
bool removeFirst(T obj)

If obj is in array, remove its first occurence and return true. Otherwise do nothing and return false.

removeFront
uint removeFront(const(uint) n)

Remove n of elements from the start.

removeKey
void removeKey(const(size_t) i)

Removes an element by a given index.

reserve
void reserve(const(size_t) amount)

Preallocate memory without resizing.

resize
void resize(const(size_t) newLen, T initValue)

Resize array and initialize newly added elements with initValue.

shiftLeft
void shiftLeft(const(uint) n)

Shift contents of array to the left by n positions. Does not change the size of array. n of last elements becomes default initialized.

shiftRight
void shiftRight()

Shift contents of array to the right. It inreases the size of array by 1. The first element becomes default initialized.

Properties

isDynamic
bool isDynamic [@property getter]

Returns true if the array uses dynamic memory.

Meta