I run into problem with circular dependence in a templated class. There is a code sample:
template <typename T> struct A
{
typedef typename T::C D;
//typename T::C c;
};
struct B : public A<B>
{
struct C {};
};
When I try to instantiate B, I get a compiler error: 'C' is not a member of 'B' (MSVC) or Invalid use of incomplete type 'struct B' (GCC).
What is the best way to change the sample to get it to work?
struct B_base { struct C {}; };
strucr B : A<B_base>, B_base { };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With