Template constraint and specializations

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Mar 23 15:19:20 PDT 2012


On 3/23/12, Philippe Sigaud <philippe.sigaud at gmail.com> wrote:
> It works for me

Yes but check the isA template. It seems there's something causing a
nested variadic template to fail. This won't work in a template
constraint (it returns false):

template isA(alias Foo)
{
   template isA(T)
   {
       enum bool isA = __traits(compiles,
       {
           void tester(Args...)(Foo!(Args) args);
           tester(T.init);
       });
   }
}
alias isA!Foo isFoo;

But if you change "Args..." to "Args" then it works, although only for
single-type templates.. I'm not sure what's going on..


More information about the Digitalmars-d-learn mailing list