I think it is not going to be able to use that typedef, because at that point where you need it (in Base), Derived is still incomplete.
For one thing you could just use two template arguments (of course if you need the Derived argument in the first place):
Code:
template<class Derived, class T>
class Base
{
public:
T i;
};
template<typename T>
class Derived : public Base<Derived<T>, T>
{
public:
//typedef T TYPE;
};
Another option might be to use a typetraits class that is able to extract the type from the template:
Code:
template <class T>
struct extract_type
{
};
template <template <class> class A, class T>
struct extract_type<A<T>>
{
typedef T type;
};
template< class Derived>
class Base
{
public:
typename extract_type<Derived>::type i;
};
template<typename T>
class Derived : public Base<Derived<T>>
{
public:
//typedef T TYPE;
};
int main()
{
Derived<int> d;
d.i = 10;
}