fmapOrElse

Undocumented in source.
template fmapOrElse(alias pred, alias orElse)
fmapOrElse
(
T
)
(
auto ref scope Optional!T optional
)
if (
is(typeof(orElse()) : typeof(pred(T.init)))
)

Members

Functions

fmapOrElse
auto fmapOrElse(Optional!T optional)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

auto x = Optional!string.some("foo");
assert(x.fmapOrElse!(str => str.length, () => 42) == 3);

auto y = Optional!string.none();
assert(y.fmapOrElse!(str => str.length, () => 42) == 42);

Meta