Array

A growable buffer that attempts to keep as many operations amortized as possible

Disabled Default Constructor

A disabled default is present on this object. To use it, use one of the other constructors or a factory function.

Constructors

this
this(in size_t initialCapacity)

Create a buffer with a given initial capacity

this
this(scope T[] array)

Create a buffer from a fixed-size array of elements

Members

Functions

add
void add(scope T val)

Appends a value to the end of the array

addAll
void addAll(scope A a)

Add many values in a compile-time list

clear
void clear()

Reset the element count without changing the size of the allocated chunk

ensureCapacity
void ensureCapacity(in size_t newCapacity)

Resizes the the array to be a given size manually

remove
void remove(in size_t index)

Remove an element at an index by swapping it with the last element

Properties

array
T[] array [@property getter]

Get the Array data as a D array

length
size_t length [@property getter]

Find the number of valid elements currently in the array

ptr
T* ptr [@property getter]

Get the pointer to the elements stored in the buffer

Meta