Template constraint on alias template parameter.

jmh530 john.michael.hall at gmail.com
Thu Aug 6 17:32:17 UTC 2020


On Thursday, 6 August 2020 at 16:01:35 UTC, jmh530 wrote:
> [snip]

It seems as if the T is properly Foo(T) and can only be 
instantiated with actual types. Something like below works and 
might work for me.

template test(alias T)
     if (__traits(isTemplate, T))
{
     void test(U)(U x)
         if (is(T!U : Foo!U))
     {
         import std.stdio: writeln;
         writeln("there");
     }
}


More information about the Digitalmars-d-learn mailing list