match class specialization

mandel mandel at mailinator.com
Wed Apr 25 09:08:27 PDT 2007


I like to test if a type is a specialization of a template.
The following code does not work/compile but may
show my intention.

class A(T) {}

void main() {
   alias A!(int) foo;
   if(is(foo : A) {
       /* */
   }
}

I also cannot alter class A(T){} because it's part of a library.
If A would inherit from a non template class/interface B, is(A : B) would
do the job, but that's not the case.
Any ideas?


More information about the Digitalmars-d-learn mailing list