关于优先队列问题
struct road{
int x,y,count;//横纵坐标和花费的费用
/*friend bool operator<(road a,road b)//定义结构体的优先级比较方式 //这种形式是将比较运算符内置
{
return a.count>b.count;
}*/
}st,tp;
如果将比较运算符外置,该怎么写?我自己想的不知道对不对 请给位指教。。



struct cmp
{
bool operator () (road a, road b) // 重载括号
{
return a.count >b.count; // 相当于less,大顶堆
}
};
priority_queue<road,vector<road>,cmp> q;