Tuple poilerplate code

JG someone at somewhere.com
Tue Sep 1 02:08:54 UTC 2020


Is there anyway to remove the boilerplate code of dealing with 
tuples:

I find myself having to write things like this fairly often

auto someRandomName  = f(...); //where f returns a tuple with two 
parts
auto firstPart = someRandomName[0];
auto secondPart = someRandomName[1];


Is to possible to write something so that the above is 
essentially equivalent to:

assignTuple!(firstPart,secondPart) = f(...);

The closest I can produce is using a template mixin so that I 
would have to write:

mixin AssignTuple!(()=>f(...),"firstPart","secondPart");


More information about the Digitalmars-d-learn mailing list