mirror of
https://git.suyu.dev/suyu/ext-boost.git
synced 2025-12-22 13:46:12 +01:00
Update to boost v1.63.0
This commit is contained in:
parent
f005c955f8
commit
25db91d480
535 changed files with 20797 additions and 37185 deletions
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
#include <boost/intrusive/detail/tree_value_compare.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
|
@ -30,62 +32,84 @@ namespace detail {
|
|||
|
||||
template < class KeyTypeKeyCompare
|
||||
, class ValueTraits
|
||||
, class KeyOfValue = void
|
||||
, class KeyOfValue
|
||||
>
|
||||
struct key_nodeptr_comp
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
: public ebo_functor_holder<KeyTypeKeyCompare>
|
||||
struct key_nodeptr_comp_types
|
||||
{
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::node_ptr node_ptr;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef ebo_functor_holder<KeyTypeKeyCompare> base_t;
|
||||
typedef ValueTraits value_traits;
|
||||
typedef typename value_traits::value_type value_type;
|
||||
typedef typename value_traits::node_ptr node_ptr;
|
||||
typedef typename value_traits::const_node_ptr const_node_ptr;
|
||||
typedef typename detail::if_c
|
||||
< detail::is_same<KeyOfValue, void>::value
|
||||
, detail::identity<value_type>
|
||||
, KeyOfValue
|
||||
>::type key_of_value;
|
||||
typedef typename key_of_value::type key_type;
|
||||
>::type key_of_value;
|
||||
typedef tree_value_compare
|
||||
<typename ValueTraits::pointer, KeyTypeKeyCompare, key_of_value> base_t;
|
||||
};
|
||||
|
||||
key_nodeptr_comp(KeyTypeKeyCompare kcomp, const ValueTraits *traits)
|
||||
//This function object transforms a key comparison type to
|
||||
//a function that can compare nodes or nodes with nodes or keys.
|
||||
template < class KeyTypeKeyCompare
|
||||
, class ValueTraits
|
||||
, class KeyOfValue = void
|
||||
>
|
||||
struct key_nodeptr_comp
|
||||
//Use public inheritance to avoid MSVC bugs with closures
|
||||
: public key_nodeptr_comp_types<KeyTypeKeyCompare, ValueTraits, KeyOfValue>::base_t
|
||||
{
|
||||
typedef key_nodeptr_comp_types<KeyTypeKeyCompare, ValueTraits, KeyOfValue> types_t;
|
||||
typedef typename types_t::value_traits value_traits;
|
||||
typedef typename types_t::value_type value_type;
|
||||
typedef typename types_t::node_ptr node_ptr;
|
||||
typedef typename types_t::const_node_ptr const_node_ptr;
|
||||
typedef typename types_t::base_t base_t;
|
||||
typedef typename types_t::key_of_value key_of_value;
|
||||
|
||||
template <class P1>
|
||||
struct is_same_or_nodeptr_convertible
|
||||
{
|
||||
static const bool same_type = is_same<P1,const_node_ptr>::value || is_same<P1,node_ptr>::value;
|
||||
static const bool value = same_type || is_convertible<P1, const_node_ptr>::value;
|
||||
};
|
||||
|
||||
base_t base() const
|
||||
{ return static_cast<const base_t&>(*this); }
|
||||
|
||||
BOOST_INTRUSIVE_FORCEINLINE key_nodeptr_comp(KeyTypeKeyCompare kcomp, const ValueTraits *traits)
|
||||
: base_t(kcomp), traits_(traits)
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
struct is_node_ptr
|
||||
{
|
||||
static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
|
||||
};
|
||||
|
||||
//key_forward
|
||||
template<class T>
|
||||
typename enable_if<is_node_ptr<T>, const key_type &>::type
|
||||
key_forward(const T &node) const
|
||||
{ return key_of_value()(*traits_->to_value_ptr(node)); }
|
||||
|
||||
template<class T>
|
||||
typename disable_if<is_node_ptr<T>, const T &>::type
|
||||
const key_forward(const T &key) const
|
||||
{ return key; }
|
||||
|
||||
//operator() 1 arg
|
||||
template<class KeyType>
|
||||
bool operator()(const KeyType &key1) const
|
||||
{ return base_t::get()(this->key_forward(key1)); }
|
||||
|
||||
template<class KeyType>
|
||||
bool operator()(const KeyType &key1)
|
||||
{ return base_t::get()(this->key_forward(key1)); }
|
||||
//pred(pnode)
|
||||
template<class T1>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T1 &t1, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value >::type* =0) const
|
||||
{ return base().get()(key_of_value()(*traits_->to_value_ptr(t1))); }
|
||||
|
||||
//operator() 2 arg
|
||||
template<class KeyType, class KeyType2>
|
||||
bool operator()(const KeyType &key1, const KeyType2 &key2) const
|
||||
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
|
||||
//pred(pnode, pnode)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value && is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(*traits_->to_value_ptr(t1), *traits_->to_value_ptr(t2)); }
|
||||
|
||||
template<class KeyType, class KeyType2>
|
||||
bool operator()(const KeyType &key1, const KeyType2 &key2)
|
||||
{ return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
|
||||
//pred(pnode, key)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible<T1>::value && !is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(*traits_->to_value_ptr(t1), t2); }
|
||||
|
||||
//pred(key, pnode)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible<T1>::value && is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(t1, *traits_->to_value_ptr(t2)); }
|
||||
|
||||
//pred(key, key)
|
||||
template<class T1, class T2>
|
||||
BOOST_INTRUSIVE_FORCEINLINE bool operator()
|
||||
(const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible<T1>::value && !is_same_or_nodeptr_convertible<T2>::value >::type* =0) const
|
||||
{ return base()(t1, t2); }
|
||||
|
||||
const ValueTraits *const traits_;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue