Vec

Kind of a std::vector replacement. Grow-only array, points to a (optionally aligned) memory location. This can also work as an output range. Vec is designed to work even when uninitialized, without makeVec.

Constructors

this
this(size_t initialSize, int alignment)

Creates an aligned buffer with given initial size.

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

opDollar
alias opDollar = length

Functions

clearContents
void clearContents()

Sets size to zero.

fill
void fill(T x)

Fills the buffer with the same value.

indexOf
int indexOf(T x)

Finds an item, returns -1 if not found

length
size_t length()
opCatAssign
void opCatAssign(T x)

Append an element to this buffer.

opSlice
inout(T)[] opSlice()
opSlice
inout(T)[] opSlice(size_t i1, size_t i2)
popBack
T popBack()

Pop last element

ptr
inout(T)* ptr()
pushBack
void pushBack(T x)

Append an element to this buffer.

pushBack
void pushBack(Vec other)

Appends another buffer to this buffer.

pushBack
void pushBack(T[] slice)

Appends a slice to this buffer.

releaseData
T[] releaseData()

Move. Give up owner ship of the data.

removeAndReplaceByLastElement
void removeAndReplaceByLastElement(size_t index)

Removes an item and replaces it by the last item. Warning: this reorders the array.

removeAndShiftRestOfArray
void removeAndShiftRestOfArray(size_t index)

Removes an item and shift the rest of the array to front by 1. Warning: O(N) complexity.

resize
void resize(size_t askedSize)

Resizes a buffer to hold askedSize elements.

Meta