On Tuesday, 17 July 2012 at 20:50:41 UTC, Jonathan M Davis wrote:
The problem is that if you have static ifs and the like in the
base class
which depends on compile time reflection of the derived class,
you effectively
have a recursive template definition. e.g.
class MyBase(T)
{
static if(is(tyepeof(T.func())))
{
int func() { return 42; }
}
}
I don't see how this would be any different than, say, using
__traits(derivedMembers, typeof(this)) in a struct/class
declaration.
That being said, I have never used CRTP in D so far, since
template mixins seem to be the better choice in almost all
situations.
David