I was implementing an algorithm using priority queue. Here is my code
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int first[2]={2,-2};
int second[2]={1,-1};
vector<pair<pair<int,int>,int>>vec;
class compare{
public:
bool operator()(pair<pair<int,int>,int>a,pair<pair<int,int>,int>b)
{
return a.second>b.second;
}
};
int main() {
long long int a,b,c,d;
while(cin>>a>>b>>c>>d)
{
priority_queue(pair<pair<int,int>,int>,vector<pair<pair<int,int>,int>>,compare) q;
map<pair<int,int>,bool>visited;
map<pair<int,int>,int>dist;
map<pair<int,int>,pair<int,int>> parent;
for(int i=1;i<=9;i++)
for(int j=1;j<=9;j++)
{
dist[make_pair(i,j)]=INT_MAX;
visited[make_pair(i,j)]=false;
}
dist[make_pair(a,b)] = 0;
visited[make_pair(a,b)] = true;
q.push(make_pair(make_pair(a,b),0));
while(!q.empty())
{
pair<int,int> node = q.top().first;
int distance = q.top().second;
q.pop();
//followed by relaxation step
}
}
// your code goes here
return 0;
}
The problem is I am getting the following errors:
rog.cpp: In function ‘int main()’:
prog.cpp:39:17: error: missing template arguments before ‘(’ token
priority_queue(pair<pair<int,int>,int>,vector<pair<pair<int,int>,int>>,compare) q;
^
prog.cpp:39:41: error: expected primary-expression before ‘,’ token
priority_queue(pair<pair<int,int>,int>,vector<pair<pair<int,int>,int>>,compare) q;
^
prog.cpp:39:73: error: expected primary-expression before ‘,’ token
priority_queue(pair<pair<int,int>,int>,vector<pair<pair<int,int>,int>>,compare) q;
^
prog.cpp:39:73: error: expected primary-expression before ‘)’ token
priority_queue(pair<pair<int,int>,int>,vector<pair<pair<int,int>,int>>,compare) q;
I am not able to understand what exactly is the meaning of the error.It wold be of great help if someone could clarify it for me.