我的问题是:priority_queue声明和布尔运算符<声明
我有我的计划有2类加为主;
我已经在一个类的成员函数中声明了一个priority_queue;
我必须定义的比较,我想我应该使用的代码是:
// Determine priority (in the priority queue) bool operator < (const node & a, const node & b) { return a.getPriority() > b.getPriority(); }
问:我应该在哪里插入这段代码?有人能帮助我吗?
谢谢
为什么不让它成为'node'的成员函数? – jrok 2013-02-20 13:58:29
,因为我得到一个错误:函数“运算符”的参数太多 – user1783116 2013-02-20 14:05:19
成员运算符函数只能带1个参数:'bool operator <(const node&other){return this-> priority
jrok
2013-02-20 14:07:52