match class specialization
mandel
mandel at mailinator.com
Wed Apr 25 09:54:59 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!
I didn't thought the compiler let you use TestA(U : A!(T)) without explicitly declaring T
a template variable.
Well, you code works fine when foo is A!(T) no matter what T is,
but it doesn't work when foo inherits from A!(T).
So, the problem still remains..
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