📅  最后修改于: 2022-03-11 14:44:51.466000             🧑  作者: Mango
// suppose you want to apply comparator on pair
// declaration of priority queue
priority_queue, vector>, myComp> pq;
// here myComp is comparator
struct myComp {
bool operator()(
pair& a,
pair& b)
{
return a.first > b.first;
// can write more code if required. depends upon requirement.
}
};