optional

Instantiate an Optional value.

optional
(
T
)
()

Examples

Optional!int a = 3;
a.popFront();
assert(!a.isPresent);
Optional!int a = 3;
assert(a.length == 1);

Optional!int b = none;
assert(b.length == 0);
assert(optional(3).isPresent);
int i;
assert(optional(&i).isPresent);
assert(!optional!(int*)(null).isPresent);
import std.algorithm : map;
enum value = 3;
assert(optional(value).map!(e => e).front == value);

Meta