I am trying to store pairs in priority queue and I am using a compare function that compares second value of each pair.
#include<iostream>
#include<queue>
#include<utility>
using namespace std;
class CompareDist
{
public:
bool operator()(pair<int,int> n1,pair<int,int> n2) {
return n1.second>n2.second;
}
};
int main()
{
priority_queue<pair<int,int>,CompareDist> pq;
}
When I compile this I get an error
error: no type named ‘value_type’ in ‘class CompareDist’
What could be the reason.I am new to STL.