match class specialization
BCS
BCS at pathlink.com
Wed Apr 25 09:12:46 PDT 2007
mandel wrote:
> 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?
template TestA(U : A!(T))
{
const bool TestA = true;
}
template TestA(U)
{
const bool TestA = false;
}
static if(TestA!(foo))
I haven't even tried to run that so...
More information about the Digitalmars-d-learn
mailing list