https://issues.dlang.org/show_bug.cgi?id=22736
Issue ID: 22736
Summary: Add destructuring bind for std.typecons.Tuple tuples
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
auto bind(alias fun, T)(auto ref T tuple)
if (isTuple!T && is(typeof(fun(tuple.expand))))
{
return fun(tuple.expand);
}
unittest
{
immutable t = tuple(1, 2);
auto sum = t.bind!((one, two) => one + two);
assert(sum == 3);
}
--