class Path
{ int key;
.....
public:
bool operator < (Path & right);
bool operator > (Path & right);
};
......
bool Path::operator < (Path & right)
{ return key < right.key; }
and the priority_queue is declared as
priority_queue <Path *, vector <Path *>, std::greater <Path *> > pq;
the problem is it is not sorting the paths by the key value - it is sorting them by the address that Path * points to. I am declaring the paths dynamically so I have to give the priority_queue pointers to the Path, but its sorting them by Path * not by the less than operator. any help would be appreciated - thanks











