Error using templates

Stack<Node> stack; //Gives Error.
Stack<Node<int>> stack; //gives Error. WHAT TO DO???

Error:
D:\VC 6.0\32\Expression Tree.cpp(163) : error C2955: 'Node' : use of class template requires template argument list
D:\VC 6.0\32\Expression Tree.cpp(11) : see declaration of 'Node'


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
////////////////////////////////////////////////////////////////////////////////
//``````````````````````````````````````````````````````````````````````````````
template <class T>
class Stack{
public:
	Stack();
	void push(T);
	T pop();
	bool isEmpty();
	T getTop();
private:
	struct Node{
		Node(){}
		Node(T v){ this->value = v; }
		T value;
		Node* next;
	} *top;
};


Thanks for everones time.
Last edited on
Did you try this exactly? Stack<Node<int> > stack;
Thanks a lot. I was writing: Stack<Node<int>>
And you wrote Stack<Node<int> >

Just a difference of SPACE.
Just to clarify, the issue arises because many old compilers think >> is an operator, as in:
cin >> name;

Modern compilers correctly recognize the difference, and also the C++11 standard (C++ language version of 2011) forces them to.
Topic archived. No new replies allowed.