使用boost fibonacci_heap [英] Using boost fibonacci_heap

查看:86
本文介绍了使用boost fibonacci_heap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用fibonacci_heap会导致编译错误:

struct Less: public binary_function<Node*, Node*, bool>
{
    bool operator()(const Node*& __x,  Node*& __y) const
        { return __x->time < __y->time; }

};

boost::fibonacci_heap<Node*, Less >*    m_heap;

然后

Less* ls = new Less;
m_heap = new boost::fibonacci_heap<Node*, Less >(1000, (*ls));

任何尝试运行m_heap->push(n)都会导致

no match for call to ‘(TimeSync::Less) (TimeSync::Node* const&, TimeSync::Node*&)’
UnmanagedUtils/Trading/Simulation/TimeSync.h:50: note: candidates are: bool TimeSync::Less::operator()(const TimeSync::Node*&, TimeSync::Node*&) const
/usr/local/include/boost-1_35/boost/property_map.hpp: In function ‘Reference boost::get(const boost::put_get_helper<Reference, PropertyMap>&, const K&) [with PropertyMap = boost::identity_property_map, Reference = unsigned int, K = TimeSync::Node*]’:

推荐答案

将签名更改为operator()(Node * const &, Node * const &) const.

这篇关于使用boost fibonacci_heap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆