Click here to Skip to main content
16,021,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have got some problems about template.There is an example as following.
MaxHeap<HeapNode<Typew,Typep>> * H;(1)
and the definition of the HeapNode is:
template<class Typew,class Typep>(2)
class HeadNode
{
};
then,I compile it, 4 errors on(1).So,could you tell me what does (1)exactly mean? And How can I correct these errors.
Thank you very much !


EDIT (Nelek): Additional information of the OP in "Answer 4"

Yes, I agree,it depends on the version of visual stdio.
Now,I use the VC 6.0.
And right now, I think I can get the key factor of this problem.
That is maybe I should define a class of MaxHeap first.
What do you think?
Posted
Updated 29-Dec-09 4:17am
v3

Number one creates a heap of heap nodes of type Typew and Typep. Not sure why two types are needed, and Typew and Typep should be types you define (looks like you are just using the types as they are defined by HeapNode). But just keep in mind that C++ does not like when you put two > in a row or two < in a row (confuses them with stream operators, so you'll have to put a space in between them), but I suppose that might depend on the compiler you use. Modify your original question and post the error messages you get.
 
Share this answer
 
v2
What are the errors that you get?
Which version of Visual Studio are you using?
 
Share this answer
 
If you are using an older compiler, start with replacing:

MaxHeap<HeapNode<Typew,Typep>>


with

MaxHeap<HeapNode<Typew,Typep> >


(note an extra space between the closing angle brackets)
 
Share this answer
 
v2
Yes, I agree,it depends on the version of visual stdio.
Now,I use the VC 6.0.
And right now, I think I can get the key factor of this problem.
That is maybe I should define a class of MaxHeap first.
What do you think?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900