Type in derived template class unknown

S

sygnosys

Hi,

I'm using VC++ 2005 can anyone tell me what's wrong with the following
piece of code.
It simply does not compile spitting out the following error "error
C2039: 'TypeDerived' : is not a member of 'Derived<X>'"

template <class X, class Y>
class Base {
public:

typename X::Type m_DerivedTypeA;
typename Y::TypeDerived m_DerivedTypeB;
};

class OutSide
{
public:
typedef int Type;
};

template <class X>
class Derived: public Base<X,Derived<X> >
{
public:
typedef int TypeDerived;

};

Derived<OutSide> variable;


Thanks
Cláudio Albuquerque
 
W

werasm

Hi,

I'm using VC++ 2005 can anyone tell me what's wrong with the following
piece of code.
It simply does not compile spitting out the following error "error
C2039: 'TypeDerived' : is not a member of 'Derived<X>'"

template <class X, class Y>
class Base {
public:

typename X::Type m_DerivedTypeA;
typename Y::TypeDerived m_DerivedTypeB;
};

First, you would need typedef before typename here above.
class OutSide
{
public:
typedef int Type;
};

template <class X>
class Derived: public Base<X,Derived<X> >
{
public:
typedef int TypeDerived;

};

Instantiating Derived recursively. Unless you have some defined partial
specialisation that terminates the recursion, this won't compile.

Werner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top