ddash.lang.capture

Capture variables with value semantics, useful in nogc code

Members

Functions

capture
auto capture(auto ref Range range, auto ref Captures 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

unpack
template unpack(alias func)

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

Examples

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

Meta