My definition of priority queue is:
template<typename Node, typename Cmp = std::less<Node> >
struct deref_compare : std::binary_function<Node*,Node*,bool>
{
deref_compare(Cmp const& cmp = Cmp())
: cmp(cmp) {}
bool operator()(Node* a, Node* b) const {
return (a->getfValue()> b->getfValue());
}
private:
Cmp cmp;
};
typedef deref_compare<Node,std::greater<Node> > my_comparator_t;
priority_queue<Node*,vector<Node*>,my_comparator_t> openq;
I am doing:
openq.push(myNode)
After entering 3-4 nodes I am getting segmentation fault.
mynode
is not empty.
How can i resolve it?