Hi all,
 
In C++ I have created a Node class that includes a member variable called
cost of type double and a getCost() function. This value represents the cost
of the path to the node when traversing from the root.
 
I want to create a priority queue that I can add pointers to the node
objects, not the nodes themselves, and then have the priority queue
prioritize the pointers to these node objects based on the the nodes cost
member variable.
 
The problem is, I'm confused on the STL Priority Queue syntax I need to use
to create the priority queue and how and where I implement the comparison
function so that the priority queue will prioritize on the cost member
variable and not the pointer addresses. Normally I would just create a
priority queue as:
 
priority_queue<Node *> myQueue;
 
but I need to also do the comparison function and have it used. Does anyone
have any ideas?
 
Thanks in advance,
Dave Darrough
[EMAIL PROTECTED]
 
 
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to