mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Correct handling of comparators in boost::intrusive:
This facilitates the port of rippled to boost 1.60 while maintaining compatibility with previous versions of boost.
This commit is contained in:
committed by
Nik Bougalis
parent
8433851652
commit
97d5325468
@@ -199,9 +199,7 @@ private:
|
|||||||
, public std::binary_function <Key, element, bool>
|
, public std::binary_function <Key, element, bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeyValueCompare ()
|
KeyValueCompare () = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyValueCompare (Compare const& compare)
|
KeyValueCompare (Compare const& compare)
|
||||||
: empty_base_optimization <Compare> (compare)
|
: empty_base_optimization <Compare> (compare)
|
||||||
@@ -234,6 +232,11 @@ private:
|
|||||||
return this->member() (extract (e.value), k);
|
return this->member() (extract (e.value), k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator() (element const& x, element const& y) const
|
||||||
|
{
|
||||||
|
return this->member() (extract (x.value), extract (y.value));
|
||||||
|
}
|
||||||
|
|
||||||
Compare& compare()
|
Compare& compare()
|
||||||
{
|
{
|
||||||
return empty_base_optimization <Compare>::member();
|
return empty_base_optimization <Compare>::member();
|
||||||
@@ -251,10 +254,12 @@ private:
|
|||||||
using cont_type = typename std::conditional <
|
using cont_type = typename std::conditional <
|
||||||
IsMulti,
|
IsMulti,
|
||||||
typename boost::intrusive::make_multiset <element,
|
typename boost::intrusive::make_multiset <element,
|
||||||
boost::intrusive::constant_time_size <true>
|
boost::intrusive::constant_time_size <true>,
|
||||||
|
boost::intrusive::compare<KeyValueCompare>
|
||||||
>::type,
|
>::type,
|
||||||
typename boost::intrusive::make_set <element,
|
typename boost::intrusive::make_set <element,
|
||||||
boost::intrusive::constant_time_size <true>
|
boost::intrusive::constant_time_size <true>,
|
||||||
|
boost::intrusive::compare<KeyValueCompare>
|
||||||
>::type
|
>::type
|
||||||
>::type;
|
>::type;
|
||||||
|
|
||||||
@@ -1254,6 +1259,7 @@ aged_ordered_container (
|
|||||||
clock_type& clock,
|
clock_type& clock,
|
||||||
Compare const& comp)
|
Compare const& comp)
|
||||||
: m_config (clock, comp)
|
: m_config (clock, comp)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1275,6 +1281,7 @@ aged_ordered_container (
|
|||||||
Compare const& comp,
|
Compare const& comp,
|
||||||
Allocator const& alloc)
|
Allocator const& alloc)
|
||||||
: m_config (clock, comp, alloc)
|
: m_config (clock, comp, alloc)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1297,6 +1304,7 @@ aged_ordered_container (InputIt first, InputIt last,
|
|||||||
clock_type& clock,
|
clock_type& clock,
|
||||||
Compare const& comp)
|
Compare const& comp)
|
||||||
: m_config (clock, comp)
|
: m_config (clock, comp)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
insert (first, last);
|
insert (first, last);
|
||||||
}
|
}
|
||||||
@@ -1322,6 +1330,7 @@ aged_ordered_container (InputIt first, InputIt last,
|
|||||||
Compare const& comp,
|
Compare const& comp,
|
||||||
Allocator const& alloc)
|
Allocator const& alloc)
|
||||||
: m_config (clock, comp, alloc)
|
: m_config (clock, comp, alloc)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
insert (first, last);
|
insert (first, last);
|
||||||
}
|
}
|
||||||
@@ -1331,6 +1340,7 @@ template <bool IsMulti, bool IsMap, class Key, class T,
|
|||||||
aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
|
aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
|
||||||
aged_ordered_container (aged_ordered_container const& other)
|
aged_ordered_container (aged_ordered_container const& other)
|
||||||
: m_config (other.m_config)
|
: m_config (other.m_config)
|
||||||
|
, m_cont (other.m_cont.comp())
|
||||||
{
|
{
|
||||||
insert (other.cbegin(), other.cend());
|
insert (other.cbegin(), other.cend());
|
||||||
}
|
}
|
||||||
@@ -1341,6 +1351,7 @@ aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
|
|||||||
aged_ordered_container (aged_ordered_container const& other,
|
aged_ordered_container (aged_ordered_container const& other,
|
||||||
Allocator const& alloc)
|
Allocator const& alloc)
|
||||||
: m_config (other.m_config, alloc)
|
: m_config (other.m_config, alloc)
|
||||||
|
, m_cont (other.m_cont.comp())
|
||||||
{
|
{
|
||||||
insert (other.cbegin(), other.cend());
|
insert (other.cbegin(), other.cend());
|
||||||
}
|
}
|
||||||
@@ -1361,6 +1372,7 @@ aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
|
|||||||
aged_ordered_container (aged_ordered_container&& other,
|
aged_ordered_container (aged_ordered_container&& other,
|
||||||
Allocator const& alloc)
|
Allocator const& alloc)
|
||||||
: m_config (std::move (other.m_config), alloc)
|
: m_config (std::move (other.m_config), alloc)
|
||||||
|
, m_cont (std::move(other.m_cont.comp()))
|
||||||
{
|
{
|
||||||
insert (other.cbegin(), other.cend());
|
insert (other.cbegin(), other.cend());
|
||||||
other.clear ();
|
other.clear ();
|
||||||
@@ -1383,6 +1395,7 @@ aged_ordered_container (std::initializer_list <value_type> init,
|
|||||||
clock_type& clock,
|
clock_type& clock,
|
||||||
Compare const& comp)
|
Compare const& comp)
|
||||||
: m_config (clock, comp)
|
: m_config (clock, comp)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
insert (init.begin(), init.end());
|
insert (init.begin(), init.end());
|
||||||
}
|
}
|
||||||
@@ -1406,6 +1419,7 @@ aged_ordered_container (std::initializer_list <value_type> init,
|
|||||||
Compare const& comp,
|
Compare const& comp,
|
||||||
Allocator const& alloc)
|
Allocator const& alloc)
|
||||||
: m_config (clock, comp, alloc)
|
: m_config (clock, comp, alloc)
|
||||||
|
, m_cont (comp)
|
||||||
{
|
{
|
||||||
insert (init.begin(), init.end());
|
insert (init.begin(), init.end());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ private:
|
|||||||
template <class String>
|
template <class String>
|
||||||
bool
|
bool
|
||||||
operator() (element const& lhs, String const& rhs) const;
|
operator() (element const& lhs, String const& rhs) const;
|
||||||
|
|
||||||
|
bool
|
||||||
|
operator() (element const& lhs, element const& rhs) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct transform
|
struct transform
|
||||||
@@ -81,7 +84,8 @@ private:
|
|||||||
>::type;
|
>::type;
|
||||||
|
|
||||||
using set_t = boost::intrusive::make_set <element,
|
using set_t = boost::intrusive::make_set <element,
|
||||||
boost::intrusive::constant_time_size <true>
|
boost::intrusive::constant_time_size <true>,
|
||||||
|
boost::intrusive::compare<less>
|
||||||
>::type;
|
>::type;
|
||||||
|
|
||||||
list_t list_;
|
list_t list_;
|
||||||
@@ -187,6 +191,14 @@ headers::less::operator() (
|
|||||||
return beast::ci_less::operator() (lhs.data.first, rhs);
|
return beast::ci_less::operator() (lhs.data.first, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool
|
||||||
|
headers::less::operator() (
|
||||||
|
element const& lhs, element const& rhs) const
|
||||||
|
{
|
||||||
|
return beast::ci_less::operator() (lhs.data.first, rhs.data.first);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
|||||||
Reference in New Issue
Block a user