Get template and its instantiation parameters

BCS none at anon.com
Wed Oct 7 09:54:37 PDT 2009


Hello Michal,

> If one has a template instance, is it possible to get template name
> and parameter type that was used for instantiating, at compile time?
> 
> consider:
> 
> class List (T) {}
> 
> List!(int) lst;
> Foo (lst);
> I want to create such template Foo which prints:
> List!(int)
> List
> int

You could try parsing T.stringof at compiletime to extract the parts you need.




More information about the Digitalmars-d-learn mailing list