I want to get the Test type from the Base template type, which I specialize in a derived type (i.e. Base<Test> ).
Inside a templated type, I want to use the typedef defined in the derived type (template parameter).
However, I get this compilation error:
error C2039: 'X' : is not a member of 'Test'
Here is the code snippet:
template <typename T> class Base { protected: void func(typename T::X x) {} }; class Test : public Base<Test> { public: typedef int X; };
This is doable, and if so, what correction do I need to do?
(I see a couple of answers for this problem, but it looks like my script is not fixed with the typename prefix - is there something to do with getting a template specialized with a derived type?)
source share