someType since lamePtr<U> is a "dependent name". It depends on what U refers to if there is a ptr member, and if so, which βthingβ belongs to that member.
Of course, you know that for all T , lamePtr<T>::ptr is a type, but the parser does not know this at this stage of compilation.
Use the typename keyword to hint at the parser that it is a type. The rest will be resolved later in the compilation process. Just a little C ++ quirk.
template <typename U> class lamePtr { public: typedef U* ptr; }; template <typename U> class smarterPointer { public: void funFun() { typedef lamePtr<U> someType; typename someType::ptr query; } };
Lightness races in orbit
source share