andThen

Undocumented in source. Be warned that the author may not have intended to support it.
  1. auto andThen(Optional!T optional)
  2. auto andThen(Optional!T optional)
  3. auto andThen(Optional!T optional)
    andThen
    (
    alias pred
    T
    )
    (
    auto ref scope Optional!T optional
    )
    if (
    !isOptional!(typeof(pred(T.init))) &&
    !isSome!(typeof(pred(T.init)))
    &&
    !isNone!(typeof(pred(T.init)))
    )

Examples

alias O = Optional!int;
assert(O.none.andThen!(i => i + 3) == none);
assert(O.some(7).andThen!(i => i + 3) == 10.some);

Meta