模板问题
- C/C++ code
template< typename T >struct StackNode{ //堆栈的节点 T data; struct StackNode * next;};struct Stackstack{ //堆栈 struct StackNode * base; struct StackNode * top;};
这样编译出错,
template argument required for `struct StackNode
ISO C++ forbids declaration of `base' with no type
[解决办法]
- C/C++ code
template< typename T >struct StackNode{ //堆栈的节点 T data; struct StackNode * next;};template< typename T >struct Stackstack{ //堆栈 struct StackNode<T> * base; struct StackNode<T> * top;};