Here is a simplified example:
template<typename T>
class MyTemplate
{
class Inner {};
Inner met();
};
template<typename T>
MyTemplate<T>::Inner MyTemplate<T>::met()
{ }
I get the following compilation error:
expected constructor, destructor, or type conversion before 'met'
I use GCC. It seems the compiler doesn't recognize MyTemplate<T>::Inner
as a proper class. How can I fix this? I've tried sticking the typename
keyword here and there to no avail. Right now, the only way I can manage to compile this is to inline the method definition in the class declaration, which I would like to avoid.