Module ddash.lang.capture

Capture variables with value semantics, useful in nogc code

Example

import std.range: only;
    import std.algorithm: map;
    auto xs = only(1, 2, 3);
    const a = 2, b = 3;
    xs.capture(a, b).map!(unpack!((x, a, b) => x * a * b));

Functions

NameDescription
capture(range, captures) The capture function takes a range as the first argument and a list of arguments you want to capture by value to pass along to another range

Templates

NameDescription
unpack Complements the capture function by allowing you to unpack a capture tuple in the function you want to call it from.