Optional

Optional: None, Some

Functions: operator==, print

enum Optional<T>

A value that may be absent.

None

None

Some

Some(T value),

operator==

bool operator== <T: Comparable>(Optional<T>& a, Optional<T>& b)

Returns true if both optionals are equal.

bool operator== <T: Comparable>(Optional<T>& a, T& b)

Returns true if the optional holds a value equal to b.

bool operator== <T: Comparable>(T& a, Optional<T>& b)

Returns true if the optional holds a value equal to a.

bool operator== <T: Comparable>(Optional<T*>& a, T& b)

Returns true if the optional pointer is non-null and points to a value equal to b.

bool operator== <T: Comparable>(T& a, Optional<T*>& b)

Returns true if the optional pointer is non-null and points to a value equal to a.

print

void print<T: Printable>(Optional<T>& optional)

Prints the given value.