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

Timothee Cour thelastmammoth at gmail.com
Sat Jun 22 17:34:23 PDT 2013


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

> 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.
>


there's also this case:
template E8(T){
struct B{}
struct A{}
}

pragma(msg,__LINE__,":",getTemplate!(E8!(float))); => works with template
getTemplate(alias T : TI!TP, alias TI, TP...) specialization

pragma(msg,__LINE__,":",getTemplate!(E8!(float).A)); =>  ??
how to make the 2nd work?

is there something like:
template getTemplate(alias T : TI!TP.TE, alias TI, alias TE, TP...) {...}
available ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130622/13bad216/attachment.html>


More information about the Digitalmars-d mailing list