Template Function eastl::pop_heap(RandomAccessIterator, RandomAccessIterator)

Function Documentation

template<typename RandomAccessIterator>
void eastl::pop_heap(RandomAccessIterator first, RandomAccessIterator last)


Removes the first item from the heap (which is an array), and adjusts the heap so that the highest priority item becomes the new first item.

Example usage: vector<int> heap;

heap.push_back(2); heap.push_back(3); heap.push_back(1); <use heap[0], which is the highest priority item in the heap> pop_heap(heap.begin(), heap.end()); // Moves heap[0] to the back of the heap and adjusts the heap. heap.pop_back(); // Remove value that was just at the top of the heap