On Wednesday, 4 June 2014 at 14:16:31 UTC, Meta wrote:
On Wednesday, 4 June 2014 at 11:28:52 UTC, Kagamin wrote:
Does one really needs only one component, but not the others?
Maybe it should provide full computed broken form instead of
separate components?
auto d=dur.breakUp;
d.hours; d.minutes; d.seconds;
In some glorious future where we can destructure tuples, you
could do something like this:
(hours, minutes, seconds) = dur.parts;
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);
}