Determine if a type if derived from a template parameter

Adam D. Ruppe destructionator at gmail.com
Wed Apr 10 20:42:43 UTC 2019


On Wednesday, 10 April 2019 at 19:32:49 UTC, rikki cattermole 
wrote:
>     alias Y = X!(int, long);
>
>     static if (is(Y : X!(W, Z), W, Z)) {

Yup. And if you don't know the template argument count, you can 
use a variadic placeholder

static if(is(Y : X!(R), R...)) {
   // you now know that Y is an instance of X,
   // and R is the parameters that were passed to it
}


This thread should have been in learn btw.


More information about the Digitalmars-d mailing list