hasUniqueReturn

Undocumented in source.
alias hasUniqueReturn = returnsUnique

Examples

import core.memory : pureMalloc;

static int identity(int x)  @safe nothrow @nogc { return x; }
static int identityP(int x) pure nothrow @safe @nogc { return x; }
static assert( returnsUnique!identity);
static assert( returnsUnique!identityP);

static auto makeBytes(size_t n)  @safe nothrow @nogc { return pureMalloc(n); }
static auto makeBytesP(size_t n) pure nothrow @safe @nogc { return pureMalloc(n); }
static assert( returnsUnique!makeBytes);
static assert( returnsUnique!makeBytesP);

static int* f(scope return int *x) pure nothrow @safe @nogc { return x; }
static assert(!returnsUnique!f);

struct Sint { int x; }
static Sint fS(scope return Sint x) pure nothrow @safe @nogc { return x; }
static assert( returnsUnique!fS);

struct Sintp { int* x; }
static Sintp fSintp(scope return Sintp x) pure nothrow @safe @nogc { return x; }
static assert(!returnsUnique!fSintp);

struct S3 { immutable int* x; }
static S3 fS3(scope return S3 x) pure nothrow @safe @nogc { return x; }
static assert( returnsUnique!fS3);

Meta