nullify

Undocumented in source. Be warned that the author may not have intended to support it.
@safe pure nothrow @nogc
void
nullify
(
T
)
(
scope ref T x
)
if ()

Examples

import std.typecons : Nullable;

assert(null.isNull);

assert((int[]).init.isNull);
immutable int[2] x = [1, 2];
assert(!x[].isNull);

alias Ni = Nullable!int;
assert(Ni.init.isNull);

Ni ni = 3;
assert(!ni.isNull);

ni.nullify();
assert(ni.isNull);

const Ni ni2 = 3;
assert(!ni2.isNull);

struct S
{
    uint value;
    static immutable nullValue = S(value.max);
}
S s;
assert(!s.isNull);
s.nullify();
assert(s.isNull);
class C
{
    @safe pure nothrow
    this(int value)
    {
        this.value = value;
    }
    int value;
}

static assert(isNullable!C);

const x = C.init;
assert(x.isNull);

const y = new C(42);
assert(!y.isNull);

Meta