match class specialization
mandel
mandel at mailinator.com
Wed Apr 25 10:48:31 PDT 2007
BCS Wrote:
>
>
> 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...
Thank you for your quick reply!
Your code works when foo is A!(T) for every T,
but it doesn't work when foo inherits A!(T):
class A(T) {
}
class B(T) : A!(T)
{
}
template TestA(U : A!(T))
{
const bool TestA = true;
}
template TestA(U)
{
const bool TestA = false;
}
void main()
{
alias B!(int) foo; //doesn't work
//alias A!(int) foo;//work
static if(TestA!(foo)) {
Stdout("is A(T)\n");
}
}
More information about the Digitalmars-d-learn
mailing list