You are a little unfair to the compiler here. Cis incomplete without B<C>fully known and during processing B<C>, Cis still an incomplete type. There are similar streams on comp.lang.c ++. Moderated and comp.lang.c ++ .
, , , , :
struct C : B<C> {
void f() { typedef typename C::Asub Asub; }
};
, :
template<class T, class Asub> struct B { };
class C : B<C, int> { };
... , :
template<class T, class Traits> struct B {
void DoSomething(typename Traits::Asub it) {}
};
struct CTraits {
typedef int Asub;
};
struct C : B<C, CTraits> {
typedef CTraits::Asub Asub;
};