Re: A struct with a tuple as alias this, is kind of confusing

2018-07-27 Thread Yuxuan Shui via Digitalmars-d
On Friday, 27 July 2018 at 10:48:08 UTC, ag0aep6g wrote: On 07/27/2018 12:19 PM, Yuxuan Shui wrote: On Friday, 27 July 2018 at 10:17:21 UTC, Yuxuan Shui wrote: [...] Oh no, is it just defining arrays in the is() statement, though? Yup. But wait, this works: alias C = A!(1,2,3); static

Re: A struct with a tuple as alias this, is kind of confusing

2018-07-27 Thread ag0aep6g via Digitalmars-d
On 07/27/2018 12:19 PM, Yuxuan Shui wrote: On Friday, 27 July 2018 at 10:17:21 UTC, Yuxuan Shui wrote: First, it surprised me that I can't index a struct like that. So: struct A(T...) {     alias S = T;     alias S this; } alias B = A!(int, double); B[0] x; // Actually an array Then, it

Re: A struct with a tuple as alias this, is kind of confusing

2018-07-27 Thread Yuxuan Shui via Digitalmars-d
On Friday, 27 July 2018 at 10:17:21 UTC, Yuxuan Shui wrote: First, it surprised me that I can't index a struct like that. So: struct A(T...) { alias S = T; alias S this; } alias B = A!(int, double); B[0] x; // Actually an array Then, it surprised me again, that I actually can index

A struct with a tuple as alias this, is kind of confusing

2018-07-27 Thread Yuxuan Shui via Digitalmars-d
First, it surprised me that I can't index a struct like that. So: struct A(T...) { alias S = T; alias S this; } alias B = A!(int, double); B[0] x; // Actually an array Then, it surprised me again, that I actually can index it, sometimes static if (!is(B[0] == B[1])) pragma(msg,