Is it possible to check if a type is an instance of a template?

Simen Kjaeraas simen.kjaras at gmail.com
Thu Sep 15 15:45:46 PDT 2011


On Thu, 15 Sep 2011 22:45:21 +0200, Andrej Mitrovic  
<andrej.mitrovich at gmail.com> wrote:

> Cool, that works, thanks. Is this in Phobos by any chance? Otherwise
> I'll just use a more flexible version of that.

No more flexible version available, sadly. I wish this worked (I think
it's in Bugzilla somewhere):

template IsA( alias F, T ) {
     static if ( is( T t == F!U, U ) ) {
         enum IsA = true;
     } else {
         enum IsA = false;
     }
}

-- 
   Simen


More information about the Digitalmars-d-learn mailing list