NullableRef.opAssign

Assigns value to the internally-held state.

struct NullableRef(T)
void
opAssign
()
()

Parameters

value T

A value of type T to assign to this NullableRef. If the internal state of this NullableRef has not been initialized, an error will be thrown in non-release mode.

Examples

import std.exception : assertThrown, assertNotThrown;

NullableRef!int nr;
assert(nr.isNull);
assertThrown!Throwable(nr = 42);

nr.bind(new int(0));
assert(!nr.isNull);
assertNotThrown!Throwable(nr = 42);
assert(nr == 42);

Meta

Suggestion Box / Bug Report