Opened 9 years ago

Closed 9 years ago

#9665 closed Bugs (fixed)

multiIndex hashed_non_unique insert(first, last) compile error

Reported by: thomasfannes@… Owned by: Joaquín M López Muñoz
Milestone: To Be Determined Component: multi_index
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Hello,

I have a multiIndex map with one index, a hashed_non_unique. If I do an insert with a range where the iterator does not yield a reference, it will not compile. The insert function calls the final_insert_ref_, which accepts a reference.


    typedef boost::adjacency_list<boost::vecS, boost::vecS> graph;
    typedef boost::graph_traits<graph>::vertex_descriptor vertex_descriptor;
    typedef boost::multi_index_container<
            vertex_descriptor,
            boost::multi_index::indexed_by<
                boost::multi_index::hashed_non_unique<boost::multi_index::identity<vertex_descriptor> >
            >
    > container;

    container c;
    graph g;
    c.insert(boost::vertices(g).first, boost::vertices(g).second);

Gives the following error:

/usr/include/boost/multi_index/hashed_index.hpp:320: error: no matching function for call to 'boost::multi_index::detail::hashed_index<boost::multi_index::identity<long unsigned int>, boost::hash<long unsigned int>, std::equal_to<long unsigned int>, boost::multi_index::detail::nth_layer<1, long unsigned int, boost::multi_index::indexed_by<boost::multi_index::hashed_non_unique<boost::multi_index::identity<long unsigned int> > >, std::allocator<long unsigned int> >, boost::mpl::vector0<mpl_::na>, boost::multi_index::detail::hashed_non_unique_tag>::final_insert_ref_(boost::iterator_facade<boost::range_detail::integer_iterator<long unsigned int>, long unsigned int, boost::random_access_traversal_tag, long unsigned int, long int>::reference)'
     for(;first!=last;++first)this->final_insert_ref_(*first);
                              ^

Change History (1)

comment:1 by Joaquín M López Muñoz, 9 years ago

Resolution: fixed
Status: newclosed

Hi Thomas,

Thanks for spooting this bug, fixed at

https://github.com/boostorg/multi_index/commit/26d215e0637e30fac8bde92e3971259ac594c85f

I'd appreciate if you could verify this works on your side.

Note: See TracTickets for help on using tickets.