withBack

Takes a unary function that is called on back of range if it is there

withBack
(
alias fun
Range
)
(
Range range
)
if (
from!"std.range".isBidirectionalRange!Range
)

Examples

import optional: some, none;
assert((int[]).init.withBack!(a => a * a) == none);
assert([3, 2].withBack!(a => a * a) == some(4));
assert([3, 5].withBack!"a + 1" == some(6));

Meta

Since

- 0.0.1