reset

Reset a to its default value.

ref @trusted
reset
(
T
)
(
ref T a
)

Parameters

T

the argument type, likely to be infered.

a T

a reference to a T.

Examples

uint a = 159;
a.reset();
assert(a == a.init);

string b = "bla";
b.reset();
assert(b == b.init);
import std.typecons : Nullable;
auto n = Nullable!(size_t,
                   size_t.max)();
import nxt.predicates : isUntouched;
assert(n.isUntouched);
n = 0;
assert(!n.isUntouched);
assert(n == 0);
n.reset;
assert(n.isUntouched);

See Also

std.typecons.Nullable.nullify

Meta