File tree 1 file changed +6
-5
lines changed 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -3441,28 +3441,29 @@ if (is (typeof(nullValue) == T))
3441
3441
assert (ntts.to! string () == " 2.5" );
3442
3442
}
3443
3443
3444
+ // apply
3444
3445
/**
3445
3446
Unpacks the content of a $(D Nullable), performs an operation and packs it again. Does nothing if isNull.
3446
3447
3447
- When called on a $(D Nullable), $(D apply) will unpack the value contained in the $(D Nullable),
3448
+ When called on a $(D Nullable), ` apply` will unpack the value contained in the $(D Nullable),
3448
3449
pass it to the function you provide and wrap the result in another $(D Nullable) (if necessary).
3449
- If the Nullable is null, $(D apply) will return null itself.
3450
+ If the Nullable is null, ` apply` will return null itself.
3450
3451
3451
3452
Params:
3452
- t = a $(D Nullable)
3453
+ t = a ` Nullable`
3453
3454
fun = a function operating on the content of the nullable
3454
3455
3455
3456
Returns:
3456
3457
`fun(t.get).nullable` if `!t.isNull`, else `Nullable.init`.
3457
3458
3458
3459
See also:
3459
- $(HTTP en.wikipedia.org/wiki/Monad_(functional_programming)#The_Maybe_monad, The `Maybe` monad)
3460
+ $(HTTPS en.wikipedia.org/wiki/Monad_(functional_programming)#The_Maybe_monad, The `Maybe` monad)
3460
3461
*/
3461
3462
template apply (alias fun)
3462
3463
{
3463
3464
import std.functional : unaryFun;
3464
3465
3465
- auto apply (T)(T t)
3466
+ auto apply (T)(auto ref T t)
3466
3467
if (isInstanceOf! (Nullable, T) && is (typeof (unaryFun! fun(T.init.get ))))
3467
3468
{
3468
3469
alias FunType = typeof (unaryFun! fun(T.init.get ));
You can’t perform that action at this time.
0 commit comments