Re: Getting template parameters by its name

2019-01-11 Thread Yui Hosaka via Digitalmars-d-learn
On Friday, 11 January 2019 at 06:13:11 UTC, Paul Backus wrote: On Friday, 11 January 2019 at 04:59:50 UTC, Yui Hosaka wrote: I want to do something like this: template S(T) { } void main() { pragma(msg, S!(int).T); // Error: no property `T` for type `void` } You can get the ar

Re: Getting template parameters by its name

2019-01-10 Thread Paul Backus via Digitalmars-d-learn
On Friday, 11 January 2019 at 04:59:50 UTC, Yui Hosaka wrote: I want to do something like this: template S(T) { } void main() { pragma(msg, S!(int).T); // Error: no property `T` for type `void` } You can get the arguments of a template instance as an AliasSeq using `std.traits

Getting template parameters by its name

2019-01-10 Thread Yui Hosaka via Digitalmars-d-learn
I want to do something like this: template S(T) { } void main() { pragma(msg, S!(int).T); // Error: no property `T` for type `void` } Using alias, it is possible to get T by another name: template S(T) { alias t = T; } void main() { pragma(msg, S!(int).t); } But