TypeTuple!(T...) vs Tuple!(T...)

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 2 04:49:17 PDT 2015


On Tuesday, 2 June 2015 at 08:10:27 UTC, rsw0x wrote:
> The tuple page is even confusing me
> http://dlang.org/tuple.html
>
>>A variable declared with a TypeTuple becomes an ExpressionTuple:
>>alias TL = Tuple!(int, long);
>
> is it using Tuple!(T...) and TypeTuple!(T...) interchangeably?

Almost.

`Tuple` is defined at the top of the article as `template 
Tuple(E...) {alias Tuple = E;}`.

"TypeTuple" is later defined as a `Tuple` whose elements 
"elements are solely types".

So, in the context of the article, `Tuple!(int, long)` is a 
"TypeTuple", because it's a `Tuple` of types.

The article does not refer to `std.typecons.Tuple` or 
`std.typetuple.TypeTuple` at all. Specifically, the article's 
`Tuple` is not `std.typecons.Tuple`. And the article's 
"TypeTuple" is not `std.typetuple.TypeTuple`. However, going for 
bonus confusion points, the article's `Tuple` is defined the same 
as `std.typetuple.TypeTuple`.


More information about the Digitalmars-d-learn mailing list