Rumah > Soal Jawab > teks badan
阿神2017-04-17 13:32:31
template <typename Element>
class Node {
public: // 加上限定符就好了
typedef Node<Element>* PtrToNode;
};
int main() {
Node<int>::PtrToNode p = new Node<int>;
delete p;
}
天蓬老师2017-04-17 13:32:31
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