On Wednesday, 4 June 2014 at 17:06:22 UTC, Meta wrote:
On Wednesday, 4 June 2014 at 15:51:58 UTC, John Colvin wrote:
Assuming hours, minutes and seconds are already declared, you
can do this already
TypeTuple!(hours, minutes, seconds) = dur.parts;
A full working example of the syntax:
import std.typetuple;
import std.typecons;
import std.stdio;
void main()
{
int a,b;
TypeTuple!(a, b) = tuple(5, 8);
assert(a == 5 && b == 8);
}
*Assuming they're already declared* is the thing to note.
There's little point in a tuple destructuring syntax if you
have to declare the variables beforehand anyway.
I would say it's still quite useful, but I agree it's not ideal.