Hello everyone,
I came across the following in a book:
Keyword typename
The keyword typename was introduced to specify that the identifier that follows is a type.
Consider the following example:
template <class T>
Class MyClass {
typename T:: SubType * ptr;
...
};
Here, typename is used to clarify that SubType is a type of class T. Thus, ptr is a pointer to the type T:: SubType. Without typename, SubType would be considered a static member.
Can anyone please explain this? I didn't understand what the author meant by
"Thus, ptr is a pointer to the type T:: SubType" ?
Thanks!