Getting template parameters by its name

Paul Backus snarwin at gmail.com
Fri Jan 11 06:13:11 UTC 2019


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.TemplateArgsOf`.

https://dlang.org/phobos/std_traits.html#TemplateArgsOf


More information about the Digitalmars-d-learn mailing list