Unique

A unique pointer similar to C++'s std::unique_ptr.

Constructors

this
this(auto ref Args args)

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

this
this(Allocator allocator, auto ref Args args)

Non-singleton allocator, must be passed in

this
this(Unique!(T, Allocator) other)

Destructor

~this
~this()

Postblit

this(this)
@disable this(this)

Copying this object is disabled.

Members

Functions

allocator
Allocator allocator()
construct
typeof(this) construct(auto ref Args args)

Factory method so can construct with zero args.

construct
typeof(this) construct(auto ref Allocator allocator, auto ref Args args)

Factory method. Not necessary with non-global allocator but included for symmetry.

get
inout(Pointer) get()

Gets the owned pointer. Use with caution.

opAssign
void opAssign(Unique!(T, Allocator) other)

Move from another smart pointer

opCast
bool opCast()

"Truthiness" cast

release
Pointer release()

Release ownership

unique
Unique unique()

Releases ownership and transfers it to the returned Unique object.

Meta