I have a Node class with the members
int weight;
Node *left;
Node *right;
I want to create a heap by using the STL functions
make_heap(Iterator , Iterator, comp)
pop_heap(Iterator, Iterator, comp)
to apply on a vector of Node pointers. How can I create a comparison object (or comparison function) for those functions?
If you provide strict weak ordering via a
operator<for your object you can call the overload ofmake_heap,pop_heap, etc which don’t even need the third argument.compis so you can provide a custom comparison if you choose.