I have a structure
struct state{
int cur[10];
int next[10];
int priority;
};
and a priority queue of these states.How can I manage the priority queue so that front element is the element with the minimum value of 'priority' ?
I have a structure
struct state{
int cur[10];
int next[10];
int priority;
};
and a priority queue of these states.How can I manage the priority queue so that front element is the element with the minimum value of 'priority' ?
Never mind I found the answer http://www.cplusplus.com/reference/stl/priority_queue/priority_queue/
I'll just have to use an external comparator function.
But can someone explain this?
bool operator() (const int& lhs, const int&rhs) const <<==========
{
if (reverse) return (lhs>rhs);
else return (lhs<rhs);
}