I tried to allocate memory to the priority_queue
using the constructor
, but getting the below error:
No matching constructor for initialization of 'priority_queue pq(3)'
why this is not working in priority_queue
but working correctly in vector
s?
#include <iostream>
#include <queue>
using namespace std;
int main()
{
priority_queue<int> pqueue(4);
pqueue.push(3);
pqueue.push(5);
pqueue.push(1);
pqueue.push(2);
}