I want to define a type name in a template, which I can use elsewhere to refer to a member type in a class.
template <class T> class CA { public:
and use it as follows:
template <class T> class CDerived : public CBase<typename T::ElementType1> {
and declare objects like:
typedef CDerived<CA> MyNewClass;
Is it impossible? I have code that compiles correctly under VS2010, but not under Xcode, which uses the line:
typedef typename T ElementType1;
Apparently, the compiler is expecting a qualified name after typename, but I don't see how it can be for a template type.
I do not understand the difference between ElementType1 and ElementType2 in this context.
I looked at a lot of stack overflow questions, but most of them apparently only referred to the type of declaration, for example iterator_type, in my example.
source share