match class specialization

BCS BCS at pathlink.com
Wed Apr 25 11:09:03 PDT 2007


mandel wrote:
> 
> 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..
> 

template TestA(U : A!(T))
{
	const bool TestA = true;
}

template TestA(U)
{
	static if(is(U.superof))
		const bool TestA = TestA!(U.superof);
	else
		const bool TestA = false;
}

This compiles but doesn't work. I seem to recall that there is no way to 
get the base class of a type at compile time (that is what .superof is 
supposed to be doing) If that can be replaced with something that 
acutely works, the above would work, I think.


More information about the Digitalmars-d-learn mailing list