I want to build a priority queue of an object having three elements having my own comparator. I tried the following code but is showing error .
#include<bits/stdc++.h>
using namespace std;
class triplet {
public:
int data;
int arr;
int index;
};
bool compare( triplet x, triplet y ){
if(x.data < y.data){
return true;
}
else{
return false;
}
}
int main(){
priority_queue<triplet,vector<triplet>,compare> pq1;
}
getting the following error enter image description here