Wait, what? What is AliasSeq?

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 23 08:03:23 PDT 2015


On 07/23/2015 10:42 AM, deadalnix wrote:
> On Wednesday, 22 July 2015 at 04:44:48 UTC, Timon Gehr wrote:
>> On 07/22/2015 12:53 AM, deadalnix wrote:
>>> On Tuesday, 21 July 2015 at 21:26:24 UTC, Daniel N wrote:
>>>> On Tuesday, 21 July 2015 at 16:54:54 UTC, H. S. Teoh wrote:
>>>>>
>>>>> Because, among other things, it auto-expands.
>>>>>
>>>>>
>>>>> T
>>>>
>>>> 1) .tupleof auto-expands and changing it at this point would cause
>>>> epic breakage.(I also see no reason to.)
>>>>
>>>
>>> This is actually a very good point. First of, tupleof does not return a
>>> TypeTuple, but they have something similar in nature.
>>
>> What's the difference? There shouldn't be any.
>
> You can't put runtime values into the first one, you can into the second
> one.

It should be just a bunch of aliases to the field members, which have 
runtime values.

Anyway, I figured out the difference:

alias Seq(T...)=T;

void main(){
     struct S{ int x,y,z; }
     S s;
     alias a=s.tupleof; // error
     alias b=Seq!(s.x,s.y,s.z); // ok
     alias c=Seq!(s.tupleof); // ok
     typeof(s.tupleof) x;
     alias d=x; // ok
}


Wtf.


More information about the Digitalmars-d mailing list