struct info {
int val;
bool operator<(const info* a)const {
return this->val > a->val;
}
};
priority_queue<info>pq;
void func()
{
pq.push({ 1 });
}
重载<运算符传入参数不应是指针,可以是变量或者引用
struct info {
int val;
bool operator<(const info& a)const {
return this->val > a.val;
}
};
priority_queue<info>pq;
void func()
{
pq.push({ 1 });
}