You can forward declare a template inner class inside a normal class, and use the defined type as any other forward declared type.
class Outer {
template <int N> class Inner;
typedef Inner<0> Inner0;
Inner0* f();
};
template<int N>
class Outer::Inner {};
Now if Outer is itself a template class, is there a way to keep the declaration of Inner outside the declaration of Outer ? Something like :
template<typename T>
class Outer {
template <int N> class Inner;
typedef Inner<0> Inner0;
Inner0* f();
};
template<typename T, int N> //This won't work
class Outer<T>::Inner {};
Is there a correct syntax to declare Outer with the right template parameters ?
Try the following
According to the C++ Standard (14.5.2 Member templates)