TypeTuple!(T...) vs Tuple!(T...)
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 2 02:34:27 PDT 2015
On 06/02/2015 01:10 AM, rsw0x wrote:
> exactly what is the difference here?
>
> I have a rather large CTFE-generated TypeTuple in one of my structs in
> my project, and I can seemingly replace it with a Tuple with absolutely
> zero differences... except I compile about 60-70% slower.
>
> 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?
Tuple can hold only values, TypeTuple can hold types as well. Tuple can
be created at run time, TypeTuple is a compile-time concept.
My guess is that your TypeTuple consists only of values. That's why they
work the same.
I have two sections about TypeTuples here:
http://ddili.org/ders/d.en/tuples.html#ix_tuples.TypeTuple,%20std.typetuple
http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.tuple%20template%20parameter
Ali
More information about the Digitalmars-d-learn
mailing list