相关疑难解决方法(0)

从STL优先级队列创建最小堆

我正在从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 ) ;
    }
Run Code Online (Sandbox Code Playgroud)

};

在main中,我实例化了一个对象.

 priority_queue<Plane*, vector<Plane*>, Plane> pq1 ;
 pq1.push(new Plane(0, 0)) ;
Run Code Online (Sandbox Code Playgroud)

我收到一个xutility我无法理解的错误.

d:\ microsoft visual studio 10.0\vc\include\xutility(674):错误C2064:term不评估为带有2个参数的函数

任何对其解决方案的帮助将不胜感激.

c++ priority-queue min-heap

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

c++ ×1

min-heap ×1

priority-queue ×1