question on tuples and expressions

leo leo at clw-online.de
Mon Jan 5 03:33:51 PST 2009


Hi,
while I was reading the language specification I stumbled across the 
following problem:

Tuple!(int, int) x = Tuple!(1, 2);  // doesn't compile
Tuple!(int, int) y = (1, 2);    // leads to y being (2, 2)

How can I initialize a tuple by providing another tuple?

I know it's still possible to assign each element of the tuple separately, 
I'm just wondering what sense it makes
to define an expression (1, 2) to be 2 of type int rather than (1, 2) of 
type (int, int).
Is there any case in which this would provide an advantage?

Leo 



More information about the Digitalmars-d-learn mailing list