Vector

Dynamic Vector without Garbage Collection

Constructors

this
this(size_t n)

Constructor

this
this(T[] src, size_t n)

Constructor

Destructor

~this
~this()

Destructor: frees all memory

Postblit

this(this)
this(this)

Constructor

Members

Functions

capacity
size_t capacity()
clear
typeof(this) clear()

Clears entire vector

erase
typeof(this) erase(size_t n)

Erases nth vector element

length
size_t length()
opApply
int opApply(int delegate(ref T) nothrow @(nogc) dg)
int opApply(int delegate(ref size_t, ref T) nothrow @(nogc) dg)

This method is used in foreach()

opAssign
typeof(this) opAssign(typeof(this) rhs)

Ref. counting during structure assignment

opBinary
typeof(this) opBinary(T rhs)
typeof(this) opBinary(T[] rhs)
typeof(this) opBinary(typeof(this) rhs)

Appends a value to the vector using << operator

opDollar
size_t opDollar()

The $ operator returns the length of the vector

opIndex
T opIndex(size_t id)

The [] operator

opSlice
typeof(this) opSlice(size_t a, size_t b)

The a..b operator returns the slice of the vector

pop
void pop()

Removes the last element from the vector

ptr
T* ptr()
push
typeof(this) push(T rhs)
typeof(this) push(T[] rhs)
typeof(this) push(typeof(this) rhs)

Appends a value to the vector

shrink
typeof(this) shrink(size_t len)

Shrinks vector

shrink_to_fit
typeof(this) shrink_to_fit()

Requests the removal of unused capacity.

trim
typeof(this) trim()

Trims the capacity of the vector to be the vector's current size.

Meta