【问题标题】:Boost.MultiIndex template substitution failure?Boost.MultiIndex 模板替换失败?
【发布时间】:2013-07-08 21:24:43
【问题描述】:

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

/opt/local/include/boost/multi_index/hashed_index.hpp:743:9: 错误: '班级 boost::multi_index::detail::hashed_index, boost::hash, std::equal_to, boost::multi_index::detail::nth_layer, boost::multi_index::ordered_non_unique, &md::Order::px> > >, 标准::分配器 > >, boost::mpl::vector0, boost::multi_index::detail::hashed_unique_tag>' 没有名为的成员 ‘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;
}

【问题讨论】:

    标签: c++ boost boost-multi-index


    【解决方案1】:

    未能包含&lt;boost/multi_index/ordered_índex.hpp&gt;

    【讨论】:

    • 啊。显然,在以前的源文件中,我正在导入 ,它似乎一直在导入 。谢谢。
    猜你喜欢
    • 2019-07-31
    • 1970-01-01
    • 2013-06-20
    • 2018-04-28
    • 2019-09-11
    • 2014-09-22
    • 1970-01-01
    • 1970-01-01
    • 2020-12-08
    相关资源
    最近更新 更多