C++ priorityqueue pop function is used to remove the top element of the priorityqueue. The value of this function can be retrieved before being popped by calling top function.
Syntax
Consider priorityqueue 'pq' as a priorityqueue object.
Example
pq.pop ();
Parameter
It does not take any parameter.
Return value
Example 1
Example
#include <iostream>
#include <queue>
using namespace std;
int main()
{
priority_queue<int> mp;
mp.push(10);
mp.push(25);
mp.push(30);
mp.push(35);
mp.push(40);
cout<< "poping element ";
while(!mp.empty())
{
cout<< ' ' <<mp.top();
mp.pop();
}
return 0;
}
Output:
Output
poping element 40 35 30 25 10