Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 20, 2015 What difference between std.typecons.Tuple and std.meta.AliasSeq | ||||
---|---|---|---|---|
| ||||
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. |
September 20, 2015 Re: What difference between std.typecons.Tuple and std.meta.AliasSeq | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | AliasSeq is just a random collection of stuff. A Tuple is more like a struct. |
September 20, 2015 Re: What difference between std.typecons.Tuple and std.meta.AliasSeq | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | 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).
|
September 20, 2015 Re: What difference between std.typecons.Tuple and std.meta.AliasSeq | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alex Parrill | On Sunday, 20 September 2015 at 18:28:13 UTC, Alex Parrill wrote:
> (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).
This is what is used inside std.typecons.Tuple
|
Copyright © 1999-2021 by the D Language Foundation