What difference between std.typecons.Tuple and std.meta.AliasSeq

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 20 11:28:11 PDT 2015


On Sunday, 20 September 2015 at 18:10:49 UTC, Suliman wrote:
> Sometimes it's hard to understand the D philosophy, for example 
> now I can't understand diffrence between std.typecons.Tuple and 
> std.meta.AliasSeq. I know that in language like Python there is 
> spatial data type named tuple like:
> tup1 = ('physics', 'chemistry', 1997, 2000);
>
> But what in D? That was Tuples module, but it's look like it 
> was renamed to 
> http://forum.dlang.org/thread/mnhfhs$2b9o$1@digitalmars.com
>
> But look like std.typecons.Tuple and std.meta.AliasSeq are 
> exists. So I really can't understand what and how I should to 
> use that's all.

std.typecons.Tuple is more like Python's tuples. It effectively 
defines a struct with one field per type in the tuple definition, 
and only holds values.

std.meta.AliasSeq (aka std.typetuple.TypeTuple) is a compile-time 
construct, used mostly with templates, and is more like a list. 
They can hold types, values, or symbol aliases, but only exist 
during compilation (though you can declare a variable using an 
AliasSeq containing only types; I think this acts like defining 
one variable for each type in the seq).


More information about the Digitalmars-d-learn mailing list