Always read the documentation carefully
I happened to crash into a wall when didn't read the documentation carefully for using pushheap and popheap from the C++ STL library.
In a nutshell
vector<T> myHeap;
myHeap.push_back(T);
push_heap(myHeap.begin(), myHeap.end(), CompareFunction);
// It doesn't actually pop the heap, but put the element at the end
// of the array
push_heap(myHeap.begin(), myHeap.end(), CompareFunction);
// It actually pops the element
myHeap.pop_back();
Written by Jorge Palacios
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Documentation
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#