UniqueArray

A unique array similar to C++'s std::unique_ptr<T> when T is an array

Constructors

this
this(size_t size)

The allocator is global, so no need to pass it in to the constructor

this
this(Allocator allocator)

Non-singleton allocator, must be passed in

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Postblit

Copying this object is disabled.

A postblit is present on this object, but not explicitly documented in the source.

Members

Functions

opAssign
void opAssign(Type[] other)

Assign from a slice.

opBinary
UniqueArray opBinary(UniqueArray other)

Append to the array

opCast
bool opCast()

"Truthiness" cast

opOpAssign
void opOpAssign(Type other)

Append to the array

opOpAssign
void opOpAssign(Type[] other)

Append to the array

opOpAssign
void opOpAssign(UniqueArray other)

Append to the array

opUnary
const(Type[]) opUnary()

Dereference. const since this otherwise could be used to try and append to the array, which would not be nice

ptr
inout(Type)* ptr()

Returns a pointer to the underlying data. @system

reserve
void reserve(in long size)

Reserves memory to prevent too many allocations

unique
UniqueArray unique()

Releases ownership and transfers it to the returned Unique object.

Meta