ref tuples

Brad Anderson eco at gnuk.net
Tue Jul 2 17:22:17 PDT 2013


C++11's std::tuple includes a function std::tie that takes 
references to the arguments and returns a tuple that maintains 
the references to the arguments.

Along with the usual cases where you'd want reference semantics 
it also enables this interesting construct for unpacking tuples.

int a, b;
tie(a, b) = make_tuple(1, 2);

assert(a == 1 && b == 2);

Is there any way to do something similar with std.typecons.Tuple?


More information about the Digitalmars-d-learn mailing list