Opened 6 years ago

Closed 6 years ago

#12432 closed Bugs (fixed)

Forced KeyOfValue creation when using custom compare on insert_check

Reported by: kiril.dimitroff@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

Introducing key_of_value in 1.59 seems to have broken the custom compare feature (including subsequent versions):

    int first;
    explicit MyClass(int i) : first(i){}

Compr defines strict ordering between MyClass and int.

    typedef set< MyClass, compare<MyClass::Compr> > OrderedMap;

    ...

    int i = 1;
    auto ret = omap.insert_check(i, omap.value_comp(), commit_data);

triggers the following error:

boost_1_59_0/boost/intrusive/detail/tree_value_compare.hpp:64:26: error: no match for call to ‘(boost::move_detail::identity<MyClass>) (const int&)’

{ return KeyOfValue()(key); }

using gcc-5.4

Full snippet attached

Attachments (1)

intrusive_key_error.cpp (1.4 KB ) - added by kiril.dimitroff@… 6 years ago.
full code snippet

Download all attachments as: .zip

Change History (2)

by kiril.dimitroff@…, 6 years ago

Attachment: intrusive_key_error.cpp added

full code snippet

comment:1 by Ion Gaztañaga, 6 years ago

Resolution: fixed
Status: newclosed

Thanks for the report and the test case. Fixed in commit:

https://github.com/boostorg/intrusive/commit/9ac060a6aeb9dfd1a0bc0c70639d13dcc30258de

hopefully will be ready for Boost 1.62.

Note: See TracTickets for help on using tickets.