xxxxxxxxxx
/+dub.sdl:
dependency "optional" version="~>0.5"
+/
import std.stdio;
import optional;
void main()
{
// Create empty optional
auto a = no!int;
a.writeln; // none ([])
++a; // still none
// Assign and try doing the same stuff
a = 9;
a.writeln; // some(9)
++a;
a.writeln; // some(10)
// Acts like a range as well
import std.algorithm : map;
import std.conv : to;
auto b = 10.some;
auto c = no!int;
alias prod = a => a * a;
b.map!prod.writeln; // [100]
c.map!prod.writeln; // empty
}