Optional.Optional

The optional itself

template Optional(T, onEmptyGet = OptionalException, exceptionArgs...)
struct Optional {}

Constructors

this
this(T value)

Constructs an optional with the value already set

Members

Functions

get
T get()

Returns the value of this optional if it is set. If not set then an exception is thrown.

isEmpty
bool isEmpty()

Checks if there is no value present

isPresent
bool isPresent()

Checks if a value is present or not

set
void set(T value)

Sets the optional's value

Static functions

empty
Optional!(T) empty()

Creates an empty optional

Meta