gpt4 book ai didi

c++ - Boost.MultiIndex 模板替换失败?

转载 作者:行者123 更新时间:2023-11-28 07:31:47 25 4
gpt4 key购买 nike

我正在尝试使用 boost::multi_index_container,它似乎在某个地方被模板元编程魔法所窒息。我收到大量错误转储,结尾为:

/opt/local/include/boost/multi_index/hashed_index.hpp:743:9: error: ‘class boost::multi_index::detail::hashed_index, boost::hash, std::equal_to, boost::multi_index::detail::nth_layer<1, boost::intrusive_ptr, boost::multi_index::indexed_by >, boost::multi_index::ordered_non_unique, &md::Order::px> > >, std::allocator > >, boost::mpl::vector0, boost::multi_index::detail::hashed_unique_tag>’ has no member named ‘final_delete_node_’ this->final_delete_node_(

我在 Mac OS X.8 Mountain Lion 上使用 Boost 1.53 (MacPorts)。如何编译以下代码?谢谢。

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/mem_fun.hpp>
#include "Product.hpp"
#include <iostream>

int main(int argc, char* argv[])
{

boost::multi_index_container<
boost::intrusive_ptr<Product>,
boost::multi_index::indexed_by<
boost::multi_index::hashed_unique<
boost::multi_index::const_mem_fun<
Product,
id_t,
static_cast<id_t (Product::*)() const>(&Product::id)
>
>,
boost::multi_index::ordered_non_unique<
boost::multi_index::const_mem_fun<
Product,
price_t,
static_cast<price_t (Product::*)() const>(&Product::price)
>
>
>
> cont;

auto o = boost::intrusive_ptr<Product>(new Product());
o->id(1).price(price_t(14.75));
cont.insert(o);

auto it = cont.get<1>().find(price_t(14.75));
if (it!=cont.get<1>().end())
std::cout << *(it);

return 0;
}

最佳答案

未能包含 <boost/multi_index/ordered_índex.hpp>

关于c++ - Boost.MultiIndex 模板替换失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17536227/

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