This works in Visual C++, but not with the Sun Compiler.

Stack<Tree<int>> stack; // (Line 40)

line 40: Error: "," expected instead of ">>".
line 40: Error: Illegal value for template paramter.
line 40: Error: "," expected instead of ";".
line 40: Error: Illegal value for template paramter.

What is wrong with this declaration? Thanks.

C++ treats the closing >> as the right shift operator, not two closing brackets for a template instantiation. You need to separate those two characters with white space:

Stack<Tree<int> > stack;

C++0x is the next revision of the standard, and it should fix that problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.