gpt4 book ai didi

c++ - 使用 boost fibonacci_heap

转载 作者:行者123 更新时间:2023-11-30 04:24:45 30 4
gpt4 key购买 nike

使用 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

关于c++ - 使用 boost fibonacci_heap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12494744/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com