BCS wrote:
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.

No, you can't. You can try parsing demangle!(T.mangleof) at compiletime to extract the parts you need. stringof is a morass of inconsistency and partial information. Whenever a template gets within a mile of a type, all bets are off.

Reply via email to