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

Yuxuan Shui yshuiv7 at gmail.com
Fri Jul 27 10:17:21 UTC 2018


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, "Works!");

Why is this language like this :(


More information about the Digitalmars-d mailing list