欢迎选择我的课程,让我们一起见证您的进步~~
template <typename Element> class Node { public: // 加上限定符就好了 typedef Node<Element>* PtrToNode; }; int main() { Node<int>::PtrToNode p = new Node<int>; delete p; }
template <typename Element> class Node { }; template <typename Element> using PtrToNode = Node<Element>*; class C {}; PtrToNode<C> p;
更多内容见http://en.cppreference.com/w/cpp/language/type_alias
更多内容见http://en.cppreference.com/w/cpp/language/type_alias