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

Timothee Cour thelastmammoth at gmail.com
Sat Jun 22 17:18:10 PDT 2013


On Sat, Jun 22, 2013 at 5:07 PM, anonymous <anonymous at example.com> wrote:

> On Saturday, 22 June 2013 at 23:57:17 UTC, Timothee Cour wrote:
>
>> template getTemplate(T : TI!TP, alias TI, TP...)
>> {
>> alias getTemplate = TI;
>> }
>>
>>
>> however, indeed seems to work with types only, not functions.
>>
>
> Just add another overload (is that the correct term?) with alias T:
>
> 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...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130622/9d1e370d/attachment-0001.html>


More information about the Digitalmars-d mailing list