By disabling default construction, we can force initialization of a type. Using this feature, we'll make an object reference that will force the user to check for null before using it.
To create a NotNull struct, perform the following steps:
struct NotNull(T)with a private member of type
assert(t !is null);.
struct CheckNull(T), with a member
T. The member
Tis a property that returns
opCast(T : bool), which checks the payload for null and returns
trueif it is not null.