newUnique

Create a new shared pointer of type T*, using allocator Allocator. T will be creating by using constructor that accepts Args, or by implicitly stating *newMem = args[0].

  1. auto newUnique(Args args)
  2. auto newUnique(Args args)
    @safe @nogc @trusted
    newUnique
    (
    T
    Allocator = Mallocator
    Args...
    )
    (
    Args args
    )
    if (
    !is(T == class)
    )

Examples

auto unique = newUnique!int(42);
assert((*unique.ptr) == 42);

Meta