Passing a single tuple or multiple values
Lodovico Giaretta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 19 08:40:20 PDT 2016
On Tuesday, 19 July 2016 at 15:36:42 UTC, Lodovico Giaretta wrote:
> As you have to do `isTuple!(T[0])`, you also have to do
> `x[0].expand`.
> That's because T... works "as if" it was an array of types, and
> x, being of type T, it works "as if" it was an array of values.
> So you have to use an index in both cases.
You can find this out from the error, which says that you can't
expand an object of type `(Tuple!(int, int))`. Note the
surrounding parenthesis: they tell you that what you have is not
a Tuple, but an AliasSeq whose only member is a Tuple. If you do
`[0]` on it, you obtain the correct type, i.e. `Tuple!(int,
int)`, without the parenthesis.
More information about the Digitalmars-d-learn
mailing list