reflection over templates

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Mar 19 09:17:55 PDT 2014


On 3/19/14, Adam D. Ruppe <destructionator at gmail.com> wrote:
> Is there anything we can do with static if to identify it as a
> template?

https://github.com/D-Programming-Language/dmd/pull/3380

> And after we determine it is a template, can we extract the
> required arguments list like we can with a regular function at
> all?

Well there's TemplateArgsOf for *instantiations*, but I'm not sure how
one would do it with non-instantiations. In particular how would we
create a tuple of template parameter types where one of the parameters
was an alias?

E.g.:

template Foo(int, alias X);

alias Args = TypeTuple!(int, ???);

There is no "alias" type you could use in this case.


More information about the Digitalmars-d-learn mailing list