Tuple literal syntax

Philippe Sigaud philippe.sigaud at gmail.com
Sun Oct 10 13:42:45 PDT 2010


Whatever the conclusion on all this is, may I suggest to have a way to
concatenate tuples?

auto t1 = tuple(1, "a");                   // or (|1, "a"|) or {1,
"a"} or what have you.
auto t2 = tuple((int i, string s) { return i;});

auto result = t1 ~ t2;

result is a (int,string, int function(int,string)) tuple.

Ideally, you should also be able to add any value before or after a tuple.

auto result2 = 3.1415 ~ result;

This is easily added to std.typecons.Tuple with opBinary!"~".


More information about the Digitalmars-d mailing list