我正在嘗試使用boost :: multi_index_container,它似乎在模板元編程魔術的某處窒息。我發現了一個巨大的錯誤轉儲結束:Boost.MultiIndex模板替換失敗?
/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山獅使用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;
}
啊。顯然在之前的源文件中,我導入了,它似乎已經導入了。謝謝。 –
fredbaba