The C++ Standard Library consists of the header, `<algorithm>`

which defines a collection of functions (principally designed to deal with a range of elements). `pop_heap()`

is a method in the STL that is used to delete an element from a heap. The size of the heap effectively decreases by one.**Syntax:**

pop_heap( iterator_begin, iterator_end, comparator ); //comparator is optional

**Parameters:** The `pop_heap() `

method accepts 3 parameters

**iterator_begin**: Iterator to the initial position of heap**iterator_end**: Iterator to the final position of heap (*Note:*the range is [iterator_begin,iterator_end) )**comparator:**Binary function that accepts two elements in the range as arguments, and returns a value convertible to bool.

**Return value:** none

## Example of pop_heap() method

#include<iostream> #include<algorithm> #include<vector> using namespace std; int main() { vector<int> v; v.push_back(4); v.push_back(3); v.push_back(8); v.push_back(-5); v.push_back(7); make_heap(v.begin(), v.end()); cout<<"Initial heap: "<<v.front()<<endl; //max val pop_heap(v.begin(), v.end()); cout<<"New heap: "<<v.front()<<endl; //max val }

**Output:**

Initial heap: 8 New heap: 7