NotNull

An of a reference type T never being null.

* Must be initialized when declared.

* Can never be assigned the null literal (compile time error).

* If assigned a null value at runtime an exception will be thrown.

NotNull!T can be substituted for T at any time, but T cannot become NotNull without some attention: either declaring NotNull!T, or using the convenience function, enforceNotNull!T.

Condition: T must be a reference type.

Constructors

this
this()
Undocumented in source.
this
this(T value)

Constructs with a runtime not null check (via assert()).

this
this(typeof(null) )

Disable null construction.

Alias This

get

Members

Functions

opAssign
typeof(this) opAssign(NotNull!U rhs)

Assignment from NotNull inherited class rhs to NotNull base class this.

opAssign
typeof(this) opAssign(typeof(null) )

Disable null assignment.

opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
NotNull!U opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

_valueHelper
NotNull!(BaseClassesTuple!T[0]) _valueHelper [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
_valueHelper
inout(T) _valueHelper [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
get
inout(T) get [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

int myInt;
NotNull!(int *) not_null = &myInt;
// you can now use variable not_null anywhere you would
// have used a regular int*, but with the assurance that
// it never stored null.

Meta