feature request: __traits(getTemplate, A!T) => A; __traits(getTemplateArguments, A!(T,"foo")) => (T,"foo")

anonymous anonymous at example.com
Sat Jun 22 17:24:32 PDT 2013


On Sunday, 23 June 2013 at 00:18:23 UTC, Timothee Cour wrote:
> On Sat, Jun 22, 2013 at 5:07 PM, anonymous 
> <anonymous at example.com> wrote:
[...]
>> template getTemplate(alias T : TI!TP, alias TI, TP...)
>> {
>> alias getTemplate = TI;
>> }
>>
>
> did you test it? doesn't work for me:
>
>  auto fun(T)(T x){return x;}
> pragma(msg,__LINE__,":",getTemplate!(fun!double));
>
> Error: template instance getTemplate!(fun) does not match 
> template
> declaration getTemplate(alias T : TI!(TP), alias TI, TP...)

Oh, sorry. I had tested it with generic templates and assumed it 
would work with everything that's not a type. No ideas on how to 
make it work with function templates then.


More information about the Digitalmars-d mailing list