Is there a way to get the types of all template parameters?

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jun 4 08:37:44 PDT 2015


On Thursday, 4 June 2015 at 14:12:08 UTC, ketmar wrote:
> On Thu, 04 Jun 2015 13:38:18 +0000, Atila Neves wrote:
>
>> For regular runtime parameters, there's ParameterTypeTuple. 
>> How would I
>> write an equivalent template for template parameters? i.e.
>> 
>>      void fun(Foo foo, Bar bar)() {}
>> 
>>      alias types = CtParameterTypeTuple!fun; //TypeTuple!(Foo, 
>> Bar)
>> 
>> I've tried but my is expression kung fu was weak.
>
> actually, you can't. uninstantiated template cannot be 
> processed by
> anything, as it's not semanticed yet. and to semantic it, you 
> have to
> instantiate it.

The way I wrote it, no. But if they all have default values, then
yes:

TemplateArgsOf!(fun!())

Atila


More information about the Digitalmars-d-learn mailing list