Question

I'm attempting to use boost::multi_index_container and it seems to be choking on the template metaprogramming magic somewhere. I'm getting a massive error dump ending in:

/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_(

I'm using Boost 1.53 (MacPorts) on Mac OS X.8 Mountain Lion. How do I get the following code to compile? Thanks.

#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;
}
Was it helpful?

Solution

Failure to include <boost/multi_index/ordered_índex.hpp>?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top