【发布时间】:2012-12-07 15:00:07
【问题描述】:
我正在从 stl 优先级队列创建一个最小堆。这是我正在使用的课程。
class Plane
{
private :
int id ;
int fuel ;
public:
Plane():id(0), fuel(0){}
Plane(const int _id, const int _fuel):id(_id), fuel(_fuel) {}
bool operator > (const Plane &obj)
{
return ( this->fuel > obj.fuel ? true : false ) ;
}
};
我在 main 中实例化了一个对象。
priority_queue<Plane*, vector<Plane*>, Plane> pq1 ;
pq1.push(new Plane(0, 0)) ;
我收到来自xutility 的错误,我无法理解。
d:\microsoft visual studio 10.0\vc\include\xutility(674): error C2064: term 不计算为采用 2 个参数的函数
对其解决方案的任何帮助将不胜感激。
【问题讨论】:
标签: c++ priority-queue min-heap