is expression on templated types

simendsjo simen.endsjo at pandavre.com
Sat Jun 25 06:57:03 PDT 2011


I have a templated struct, and I'd like to check if a given type is this 
struct. I have no idea how I should write the is expression..

struct S(int C, int R, T) {
     T[C][R] data;
}
template isS(T) {
     enum isS = is(T : S); // How can I see if T is a kind of S no 
matter what values S is parameterized on?
}
unittest {
     static assert(isS!(S!(1,1,float)));
     static assert(!isS!(float[1][1]));
}


More information about the Digitalmars-d-learn mailing list