May 08, 2017 enum tuple subscript as template parameter => Tuple(A(0)) must be an array or pointer type, not Tuple!(A) | ||||
---|---|---|---|---|
| ||||
Hi, I'm having a bit of an issue here and the compiler is not really explicit. Here's the code: import std.typecons; struct A { int i; } void main() { enum t = tuple(A()); f!(t[0].i); //Error: Tuple(A(0)) must be an array or pointer type, not Tuple!(A) f!((&t[0]).i) //Ok enum v = t[0]; f!(v.i); //Error: template instance f!(i) does not match template declaration f(int T)() f!((v.i)); //Ok } void f(int T)() {} |
Copyright © 1999-2021 by the D Language Foundation