Unique.opAssign

Initialized this Unique and takes ownership over rhs.

To reset $(D_PSYMBOL Unique) assign $(D_KEYWORD null).

If the allocator wasn't set before, $(D_PSYMBOL defaultAllocator) will be used. If you need a different allocator, create a new $(D_PSYMBOL Unique) and assign it.

  1. typeof(this) opAssign(Payload!T rhs)
    struct Unique(T)
    ref
    typeof(this)
    opAssign
    (
    Payload!T rhs
    )
  2. typeof(this) opAssign(typeof(null) )
  3. typeof(this) opAssign(typeof(this) rhs)

Parameters

rhs Payload!T

New object.

Return Value

Type: typeof(this)

$(D_KEYWORD this).

Examples

auto rc = defaultAllocator.unique!int(5);
rc = defaultAllocator.make!int(7);
assert(*rc == 7);

Meta