[Boost-bugs] [Boost C++ Libraries] #13318: key_of_value now changes the type in the priority comparison for intrusive::treap_set

Subject: [Boost-bugs] [Boost C++ Libraries] #13318: key_of_value now changes the type in the priority comparison for intrusive::treap_set
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-04 08:03:30


#13318: key_of_value now changes the type in the priority comparison for
intrusive::treap_set
-------------------------------------------+---------------------------
 Reporter: Jan Martin Mikkelsen <janm@…> | Owner: Ion Gaztañaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: intrusive
  Version: Boost 1.65.0 | Severity: Regression
 Keywords: |
-------------------------------------------+---------------------------
 Setting the `key_of_value` option now changes the type used in the
 priority comparison, which makes it impossible to use `key_of_value` when
 the priority is entirely separate to the primary key.

 The example below uses a comparison functor; a similar problem occurs with
 `priority_compare(T const&, T const&)` function.

 This worked in 1.59, fails to compile in 1.65.1.

 {{{
 #include <boost/intrusive/treap_set.hpp>

 using namespace boost::intrusive;

 struct Test : public bs_set_base_hook<>
 {
     Test(int k, int p) : m_key(k), m_priority(p) {}

     int m_key;
     int m_priority;
 };

 struct TestKey
 {
     using type = int;
     int const& operator()(Test const& t) const { return t.m_key; }
 };

 struct PriorityCompare
 {
     bool operator()(Test const& t1, Test const& t2) const {
         return t1.m_priority < t2.m_priority;
     }
 };

 using Container =
     treap_set<Test, key_of_value<TestKey>, priority<PriorityCompare>>;

 int main()
 {
     Test t1(1, 2);
     Container c;
     c.insert(t1);
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13318>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-12-04 08:10:35 UTC