some

Type constructor for an optional having some value of T

some
(
T
)
(
auto ref T value
)

Examples

import std.range: only;
import std.algorithm: equal;

auto a = no!int;
assert(a == none);
a = 9;
assert(a == some(9));
assert(a != none);

import std.algorithm: map;
assert(only(1, 2, 3).map!some.equal(only(some(1), some(2), some(3))));

Meta