Introduced BOOST_INTRUSIVE_FORCEINLINE, disabled by default until it's more tested

This commit is contained in:
Ion Gaztañaga
2015-12-24 10:29:09 +01:00
parent 381a062e23
commit 6a9fa390ae
34 changed files with 405 additions and 337 deletions

View File

@@ -34,6 +34,7 @@ doxygen autodoc
\"BOOST_RV_REF(T)=T &&\" \\ \"BOOST_RV_REF(T)=T &&\" \\
\"BOOST_RV_REF_BEG=\" \\ \"BOOST_RV_REF_BEG=\" \\
\"BOOST_RV_REF_END=&&\" \\ \"BOOST_RV_REF_END=&&\" \\
\"BOOST_INTRUSIVE_FORCEINLINE=inline\" \\
\"list_impl=list\" \\ \"list_impl=list\" \\
\"slist_impl=slist\" \\ \"slist_impl=slist\" \\
\"bstree_impl=bstree\" \\ \"bstree_impl=bstree\" \\

View File

@@ -21,6 +21,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
#include <cstddef> #include <cstddef>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
@@ -47,16 +48,16 @@ struct any_list_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename node::const_node_ptr const_node_ptr; typedef typename node::const_node_ptr const_node_ptr;
static node_ptr get_next(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next) BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; } { n->node_ptr_1 = next; }
static node_ptr get_previous(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const const_node_ptr & n)
{ return n->node_ptr_2; } { return n->node_ptr_2; }
static void set_previous(const node_ptr & n, const node_ptr & prev) BOOST_INTRUSIVE_FORCEINLINE static void set_previous(const node_ptr & n, const node_ptr & prev)
{ n->node_ptr_2 = prev; } { n->node_ptr_2 = prev; }
}; };
@@ -68,10 +69,10 @@ struct any_slist_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename node::const_node_ptr const_node_ptr; typedef typename node::const_node_ptr const_node_ptr;
static node_ptr get_next(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next) BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; } { n->node_ptr_1 = next; }
}; };
@@ -88,22 +89,22 @@ struct any_unordered_node_traits
static const bool store_hash = true; static const bool store_hash = true;
static const bool optimize_multikey = true; static const bool optimize_multikey = true;
static node_ptr get_next(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_next(const node_ptr & n, const node_ptr & next) BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next)
{ n->node_ptr_1 = next; } { n->node_ptr_1 = next; }
static node_ptr get_prev_in_group(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_prev_in_group(const const_node_ptr & n)
{ return n->node_ptr_2; } { return n->node_ptr_2; }
static void set_prev_in_group(const node_ptr & n, const node_ptr & prev) BOOST_INTRUSIVE_FORCEINLINE static void set_prev_in_group(const node_ptr & n, const node_ptr & prev)
{ n->node_ptr_2 = prev; } { n->node_ptr_2 = prev; }
static std::size_t get_hash(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static std::size_t get_hash(const const_node_ptr & n)
{ return n->size_t_1; } { return n->size_t_1; }
static void set_hash(const node_ptr & n, std::size_t h) BOOST_INTRUSIVE_FORCEINLINE static void set_hash(const node_ptr & n, std::size_t h)
{ n->size_t_1 = h; } { n->size_t_1 = h; }
}; };
@@ -117,34 +118,34 @@ struct any_rbtree_node_traits
typedef std::size_t color; typedef std::size_t color;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; } { n->node_ptr_1 = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->node_ptr_2; } { return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; } { n->node_ptr_2 = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->node_ptr_3; } { return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; } { n->node_ptr_3 = r; }
static color get_color(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n)
{ return n->size_t_1; } { return n->size_t_1; }
static void set_color(const node_ptr & n, color c) BOOST_INTRUSIVE_FORCEINLINE static void set_color(const node_ptr & n, color c)
{ n->size_t_1 = c; } { n->size_t_1 = c; }
static color black() BOOST_INTRUSIVE_FORCEINLINE static color black()
{ return 0u; } { return 0u; }
static color red() BOOST_INTRUSIVE_FORCEINLINE static color red()
{ return 1u; } { return 1u; }
}; };
@@ -158,37 +159,37 @@ struct any_avltree_node_traits
typedef std::size_t balance; typedef std::size_t balance;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; } { n->node_ptr_1 = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->node_ptr_2; } { return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; } { n->node_ptr_2 = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->node_ptr_3; } { return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; } { n->node_ptr_3 = r; }
static balance get_balance(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n)
{ return n->size_t_1; } { return n->size_t_1; }
static void set_balance(const node_ptr & n, balance b) BOOST_INTRUSIVE_FORCEINLINE static void set_balance(const node_ptr & n, balance b)
{ n->size_t_1 = b; } { n->size_t_1 = b; }
static balance negative() BOOST_INTRUSIVE_FORCEINLINE static balance negative()
{ return 0u; } { return 0u; }
static balance zero() BOOST_INTRUSIVE_FORCEINLINE static balance zero()
{ return 1u; } { return 1u; }
static balance positive() BOOST_INTRUSIVE_FORCEINLINE static balance positive()
{ return 2u; } { return 2u; }
}; };
@@ -200,22 +201,22 @@ struct any_tree_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename node::const_node_ptr const_node_ptr; typedef typename node::const_node_ptr const_node_ptr;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->node_ptr_1; } { return n->node_ptr_1; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->node_ptr_1 = p; } { n->node_ptr_1 = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->node_ptr_2; } { return n->node_ptr_2; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->node_ptr_2 = l; } { n->node_ptr_2 = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->node_ptr_3; } { return n->node_ptr_3; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->node_ptr_3 = r; } { n->node_ptr_3 = r; }
}; };
@@ -250,19 +251,19 @@ class any_algorithms
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree. //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree.
static void init(const node_ptr & node) BOOST_INTRUSIVE_FORCEINLINE static void init(const node_ptr & node)
{ node->node_ptr_1 = 0; }; { node->node_ptr_1 = node_ptr(); };
//! <b>Effects</b>: Returns true if node is in the same state as if called init(node) //! <b>Effects</b>: Returns true if node is in the same state as if called init(node)
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
static bool inited(const const_node_ptr & node) BOOST_INTRUSIVE_FORCEINLINE static bool inited(const const_node_ptr & node)
{ return !node->node_ptr_1; }; { return !node->node_ptr_1; };
static bool unique(const const_node_ptr & node) BOOST_INTRUSIVE_FORCEINLINE static bool unique(const const_node_ptr & node)
{ return 0 == node->node_ptr_1; } { return !node->node_ptr_1; }
static void unlink(const node_ptr &) static void unlink(const node_ptr &)
{ {

View File

@@ -22,6 +22,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
#include <boost/intrusive/avltree_algorithms.hpp> #include <boost/intrusive/avltree_algorithms.hpp>
#include <boost/intrusive/pointer_plus_bits.hpp> #include <boost/intrusive/pointer_plus_bits.hpp>
@@ -68,49 +69,49 @@ struct default_avltree_node_traits_impl
typedef typename node::balance balance; typedef typename node::balance balance;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static node_ptr get_parent(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static node_ptr get_left(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static node_ptr get_right(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; } { n->right_ = r; }
static balance get_balance(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n)
{ return n->balance_; } { return n->balance_; }
static balance get_balance(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const node_ptr & n)
{ return n->balance_; } { return n->balance_; }
static void set_balance(const node_ptr & n, balance b) BOOST_INTRUSIVE_FORCEINLINE static void set_balance(const node_ptr & n, balance b)
{ n->balance_ = b; } { n->balance_ = b; }
static balance negative() BOOST_INTRUSIVE_FORCEINLINE static balance negative()
{ return node::negative_t; } { return node::negative_t; }
static balance zero() BOOST_INTRUSIVE_FORCEINLINE static balance zero()
{ return node::zero_t; } { return node::zero_t; }
static balance positive() BOOST_INTRUSIVE_FORCEINLINE static balance positive()
{ return node::positive_t; } { return node::positive_t; }
}; };
@@ -126,37 +127,37 @@ struct compact_avltree_node_traits_impl
typedef pointer_plus_bits<node_ptr, 2> ptr_bit; typedef pointer_plus_bits<node_ptr, 2> ptr_bit;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return ptr_bit::get_pointer(n->parent_); } { return ptr_bit::get_pointer(n->parent_); }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); } { ptr_bit::set_pointer(n->parent_, p); }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; } { n->right_ = r; }
static balance get_balance(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n)
{ return (balance)ptr_bit::get_bits(n->parent_); } { return (balance)ptr_bit::get_bits(n->parent_); }
static void set_balance(const node_ptr & n, balance b) BOOST_INTRUSIVE_FORCEINLINE static void set_balance(const node_ptr & n, balance b)
{ ptr_bit::set_bits(n->parent_, (std::size_t)b); } { ptr_bit::set_bits(n->parent_, (std::size_t)b); }
static balance negative() BOOST_INTRUSIVE_FORCEINLINE static balance negative()
{ return node::negative_t; } { return node::negative_t; }
static balance zero() BOOST_INTRUSIVE_FORCEINLINE static balance zero()
{ return node::zero_t; } { return node::zero_t; }
static balance positive() BOOST_INTRUSIVE_FORCEINLINE static balance positive()
{ return node::positive_t; } { return node::positive_t; }
}; };

View File

@@ -69,8 +69,8 @@ class bstree_algorithms_base
static node_ptr prev_node(const node_ptr & node) static node_ptr prev_node(const node_ptr & node)
{ {
if(is_header(node)){ if(is_header(node)){
return NodeTraits::get_right(node); //return NodeTraits::get_right(node);
//return maximum(NodeTraits::get_parent(node)); return maximum(NodeTraits::get_parent(node));
} }
else if(NodeTraits::get_left(node)){ else if(NodeTraits::get_left(node)){
return maximum(NodeTraits::get_left(node)); return maximum(NodeTraits::get_left(node));

View File

@@ -38,13 +38,18 @@
#pragma warning (disable : 4284) // odd return type for operator-> #pragma warning (disable : 4284) // odd return type for operator->
#pragma warning (disable : 4244) // possible loss of data #pragma warning (disable : 4244) // possible loss of data
#pragma warning (disable : 4521) ////Disable "multiple copy constructors specified" #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified"
#pragma warning (disable : 4522) #pragma warning (disable : 4127) //conditional expression is constant
#pragma warning (disable : 4146) #pragma warning (disable : 4146)
#pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data
#pragma warning (disable : 4127) //conditional expression is constant
#pragma warning (disable : 4706) //assignment within conditional expression
#pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR- #pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR-
#pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR- #pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR-
#pragma warning (disable : 4522)
#pragma warning (disable : 4706) //assignment within conditional expression
#pragma warning (disable : 4710) // function not inlined
#pragma warning (disable : 4714) // "function": marked as __forceinline not inlined
#pragma warning (disable : 4711) // function selected for automatic inline expansion
#pragma warning (disable : 4786) // identifier truncated in debug info
#pragma warning (disable : 4996) // "function": was declared deprecated
#endif #endif
//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE //#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE

View File

@@ -21,6 +21,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/to_raw_pointer.hpp> #include <boost/intrusive/detail/to_raw_pointer.hpp>
@@ -39,14 +40,14 @@ struct default_header_holder : public NodeTraits::node
default_header_holder() : node() {} default_header_holder() : node() {}
const_node_ptr get_node() const BOOST_INTRUSIVE_FORCEINLINE const_node_ptr get_node() const
{ return pointer_traits< const_node_ptr >::pointer_to(*static_cast< const node* >(this)); } { return pointer_traits< const_node_ptr >::pointer_to(*static_cast< const node* >(this)); }
node_ptr get_node() BOOST_INTRUSIVE_FORCEINLINE node_ptr get_node()
{ return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); } { return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); }
// (unsafe) downcast used to implement container-from-iterator // (unsafe) downcast used to implement container-from-iterator
static default_header_holder* get_holder(const node_ptr &p) BOOST_INTRUSIVE_FORCEINLINE static default_header_holder* get_holder(const node_ptr &p)
{ return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); } { return static_cast< default_header_holder* >(boost::intrusive::detail::to_raw_pointer(p)); }
}; };

View File

@@ -22,6 +22,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/move/utility_core.hpp> #include <boost/move/utility_core.hpp>
namespace boost { namespace boost {
@@ -165,57 +166,57 @@ class ebo_functor_holder
public: public:
typedef T functor_type; typedef T functor_type;
ebo_functor_holder() BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder()
: t_() : t_()
{} {}
explicit ebo_functor_holder(const T &t) BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const T &t)
: t_(t) : t_(t)
{} {}
explicit ebo_functor_holder(BOOST_RV_REF(T) t) BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(BOOST_RV_REF(T) t)
: t_(::boost::move(t)) : t_(::boost::move(t))
{} {}
template<class Arg1, class Arg2> template<class Arg1, class Arg2>
ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2)
: t_(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2)) : t_(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2))
{} {}
ebo_functor_holder(const ebo_functor_holder &x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(const ebo_functor_holder &x)
: t_(x) : t_(x)
{} {}
ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x)
: t_(x.t_) : t_(x.t_)
{} {}
ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x)
{ {
this->get() = x.get(); this->get() = x.get();
return *this; return *this;
} }
ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x)
{ {
this->get() = ::boost::move(x.get()); this->get() = ::boost::move(x.get());
return *this; return *this;
} }
ebo_functor_holder& operator=(const T &x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x)
{ {
this->get() = x; this->get() = x;
return *this; return *this;
} }
ebo_functor_holder& operator=(BOOST_RV_REF(T) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(T) x)
{ {
this->get() = ::boost::move(x); this->get() = ::boost::move(x);
return *this; return *this;
} }
T& get(){return t_;} BOOST_INTRUSIVE_FORCEINLINE T& get(){return t_;}
const T& get()const{return t_;} BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return t_;}
private: private:
T t_; T t_;
@@ -230,58 +231,58 @@ class ebo_functor_holder<T, false>
public: public:
typedef T functor_type; typedef T functor_type;
ebo_functor_holder() BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder()
: T() : T()
{} {}
explicit ebo_functor_holder(const T &t) BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const T &t)
: T(t) : T(t)
{} {}
explicit ebo_functor_holder(BOOST_RV_REF(T) t) BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(BOOST_RV_REF(T) t)
: T(::boost::move(t)) : T(::boost::move(t))
{} {}
template<class Arg1, class Arg2> template<class Arg1, class Arg2>
ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_FWD_REF(Arg1) arg1, BOOST_FWD_REF(Arg2) arg2)
: T(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2)) : T(::boost::forward<Arg1>(arg1), ::boost::forward<Arg2>(arg2))
{} {}
ebo_functor_holder(const ebo_functor_holder &x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(const ebo_functor_holder &x)
: T(static_cast<const T&>(x)) : T(static_cast<const T&>(x))
{} {}
ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(BOOST_RV_REF(ebo_functor_holder) x)
: T(BOOST_MOVE_BASE(T, x)) : T(BOOST_MOVE_BASE(T, x))
{} {}
ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_COPY_ASSIGN_REF(ebo_functor_holder) x)
{ {
const ebo_functor_holder&r = x; const ebo_functor_holder&r = x;
this->get() = x.get(); this->get() = x.get();
return *this; return *this;
} }
ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(ebo_functor_holder) x)
{ {
this->get() = ::boost::move(x.get()); this->get() = ::boost::move(x.get());
return *this; return *this;
} }
ebo_functor_holder& operator=(const T &x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x)
{ {
this->get() = x; this->get() = x;
return *this; return *this;
} }
ebo_functor_holder& operator=(BOOST_RV_REF(T) x) BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(BOOST_RV_REF(T) x)
{ {
this->get() = ::boost::move(x); this->get() = ::boost::move(x);
return *this; return *this;
} }
T& get(){return *this;} BOOST_INTRUSIVE_FORCEINLINE T& get(){return *this;}
const T& get()const{return *this;} BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return *this;}
}; };
} //namespace detail { } //namespace detail {

View File

@@ -21,6 +21,8 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
namespace boost { namespace boost {
namespace intrusive { namespace intrusive {
namespace detail { namespace detail {
@@ -37,7 +39,7 @@ class equal_to_value
: t_(t) : t_(t)
{} {}
bool operator()(ConstReference t)const BOOST_INTRUSIVE_FORCEINLINE bool operator()(ConstReference t)const
{ return t_ == t; } { return t_ == t; }
}; };

View File

@@ -21,6 +21,8 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
namespace boost { namespace boost {
namespace intrusive { namespace intrusive {
namespace detail { namespace detail {
@@ -39,7 +41,7 @@ class exception_disposer
: cont_(&cont), disp_(disp) : cont_(&cont), disp_(disp)
{} {}
void release() BOOST_INTRUSIVE_FORCEINLINE void release()
{ cont_ = 0; } { cont_ = 0; }
~exception_disposer() ~exception_disposer()
@@ -67,7 +69,7 @@ class exception_array_disposer
: cont_(&cont), disp_(disp), constructed_(constructed) : cont_(&cont), disp_(disp), constructed_(constructed)
{} {}
void release() BOOST_INTRUSIVE_FORCEINLINE void release()
{ cont_ = 0; } { cont_ = 0; }
~exception_array_disposer() ~exception_array_disposer()

View File

@@ -164,13 +164,14 @@ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG
{ {
struct BaseMixin struct BaseMixin
{ {
void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME()
{} //Some compilers require the definition or linker errors happen
}; };
struct Base struct Base
: public boost_intrusive_hmfcw::remove_cv<Type>::type, public BaseMixin : public boost_intrusive_hmfcw::remove_cv<Type>::type, public BaseMixin
{ //Declare the unneeded default constructor as some old compilers wrongly require it with is_convertible { //Declare the unneeded default constructor as some old compilers wrongly require it with is_convertible
Base(); Base(){}
}; };
template <typename T, T t> class Helper{}; template <typename T, T t> class Helper{};

View File

@@ -21,6 +21,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/assert.hpp> #include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
@@ -99,10 +100,10 @@ struct bucket_traits_impl
buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this; buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this;
} }
const bucket_ptr &bucket_begin() const BOOST_INTRUSIVE_FORCEINLINE const bucket_ptr &bucket_begin() const
{ return buckets_; } { return buckets_; }
size_type bucket_count() const BOOST_INTRUSIVE_FORCEINLINE size_type bucket_count() const
{ return buckets_len_; } { return buckets_len_; }
private: private:
@@ -160,11 +161,11 @@ class hashtable_iterator
typedef iiterator< value_traits, IsConst typedef iiterator< value_traits, IsConst
, std::forward_iterator_tag> types_t; , std::forward_iterator_tag> types_t;
public: public:
typedef typename types_t::iterator_traits::difference_type difference_type; typedef typename types_t::iterator_type::difference_type difference_type;
typedef typename types_t::iterator_traits::value_type value_type; typedef typename types_t::iterator_type::value_type value_type;
typedef typename types_t::iterator_traits::pointer pointer; typedef typename types_t::iterator_type::pointer pointer;
typedef typename types_t::iterator_traits::reference reference; typedef typename types_t::iterator_type::reference reference;
typedef typename types_t::iterator_traits::iterator_category iterator_category; typedef typename types_t::iterator_type::iterator_category iterator_category;
private: private:
typedef typename value_traits::node_traits node_traits; typedef typename value_traits::node_traits node_traits;
@@ -189,7 +190,7 @@ class hashtable_iterator
public: public:
hashtable_iterator () BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator ()
: slist_it_() //Value initialization to achieve "null iterators" (N3644) : slist_it_() //Value initialization to achieve "null iterators" (N3644)
{} {}
@@ -202,7 +203,7 @@ class hashtable_iterator
: slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits()) : slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits())
{} {}
const siterator &slist_it() const BOOST_INTRUSIVE_FORCEINLINE const siterator &slist_it() const
{ return slist_it_; } { return slist_it_; }
hashtable_iterator<BucketValueTraits, false> unconst() const hashtable_iterator<BucketValueTraits, false> unconst() const
@@ -218,28 +219,28 @@ class hashtable_iterator
return result; return result;
} }
friend bool operator== (const hashtable_iterator& i, const hashtable_iterator& i2) BOOST_INTRUSIVE_FORCEINLINE friend bool operator== (const hashtable_iterator& i, const hashtable_iterator& i2)
{ return i.slist_it_ == i2.slist_it_; } { return i.slist_it_ == i2.slist_it_; }
friend bool operator!= (const hashtable_iterator& i, const hashtable_iterator& i2) BOOST_INTRUSIVE_FORCEINLINE friend bool operator!= (const hashtable_iterator& i, const hashtable_iterator& i2)
{ return !(i == i2); } { return !(i == i2); }
reference operator*() const BOOST_INTRUSIVE_FORCEINLINE reference operator*() const
{ return *this->operator ->(); } { return *this->operator ->(); }
pointer operator->() const BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const
{ {
return this->priv_value_traits().to_value_ptr return this->priv_value_traits().to_value_ptr
(downcast_bucket(slist_it_.pointed_node())); (downcast_bucket(slist_it_.pointed_node()));
} }
const const_bucketvaltraits_ptr &get_bucket_value_traits() const BOOST_INTRUSIVE_FORCEINLINE const const_bucketvaltraits_ptr &get_bucket_value_traits() const
{ return traitsptr_; } { return traitsptr_; }
const value_traits &priv_value_traits() const BOOST_INTRUSIVE_FORCEINLINE const value_traits &priv_value_traits() const
{ return traitsptr_->priv_value_traits(); } { return traitsptr_->priv_value_traits(); }
const bucket_traits &priv_bucket_traits() const BOOST_INTRUSIVE_FORCEINLINE const bucket_traits &priv_bucket_traits() const
{ return traitsptr_->priv_bucket_traits(); } { return traitsptr_->priv_bucket_traits(); }
private: private:

View File

@@ -21,6 +21,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp> #include <boost/intrusive/detail/parent_from_member.hpp>
#include <boost/intrusive/link_mode.hpp> #include <boost/intrusive/link_mode.hpp>
@@ -54,25 +55,25 @@ struct bhtraits_base
typedef node& node_reference; typedef node& node_reference;
typedef const node & const_node_reference; typedef const node & const_node_reference;
static pointer to_value_ptr(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr & n)
{ {
return pointer_traits<pointer>::pointer_to return pointer_traits<pointer>::pointer_to
(static_cast<reference>(static_cast<node_holder_reference>(*n))); (static_cast<reference>(static_cast<node_holder_reference>(*n)));
} }
static const_pointer to_value_ptr(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr & n)
{ {
return pointer_traits<const_pointer>::pointer_to return pointer_traits<const_pointer>::pointer_to
(static_cast<const_reference>(static_cast<const_node_holder_reference>(*n))); (static_cast<const_reference>(static_cast<const_node_holder_reference>(*n)));
} }
static node_ptr to_node_ptr(reference value) BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value)
{ {
return pointer_traits<node_ptr>::pointer_to return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<node_holder_reference>(value))); (static_cast<node_reference>(static_cast<node_holder_reference>(value)));
} }
static const_node_ptr to_node_ptr(const_reference value) BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value)
{ {
return pointer_traits<const_node_ptr>::pointer_to return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value))); (static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value)));
@@ -111,26 +112,26 @@ struct mhtraits
static const link_mode_type link_mode = Hook::hooktags::link_mode; static const link_mode_type link_mode = Hook::hooktags::link_mode;
static node_ptr to_node_ptr(reference value) BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value)
{ {
return pointer_traits<node_ptr>::pointer_to return pointer_traits<node_ptr>::pointer_to
(static_cast<node_reference>(static_cast<hook_reference>(value.*P))); (static_cast<node_reference>(static_cast<hook_reference>(value.*P)));
} }
static const_node_ptr to_node_ptr(const_reference value) BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value)
{ {
return pointer_traits<const_node_ptr>::pointer_to return pointer_traits<const_node_ptr>::pointer_to
(static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P))); (static_cast<const_node_reference>(static_cast<const_hook_reference>(value.*P)));
} }
static pointer to_value_ptr(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr & n)
{ {
return pointer_traits<pointer>::pointer_to return pointer_traits<pointer>::pointer_to
(*detail::parent_from_member<T, Hook> (*detail::parent_from_member<T, Hook>
(static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P)); (static_cast<Hook*>(boost::intrusive::detail::to_raw_pointer(n)), P));
} }
static const_pointer to_value_ptr(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr & n)
{ {
return pointer_traits<const_pointer>::pointer_to return pointer_traits<const_pointer>::pointer_to
(*detail::parent_from_member<T, Hook> (*detail::parent_from_member<T, Hook>

View File

@@ -21,6 +21,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/iterator.hpp> #include <boost/intrusive/detail/iterator.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
@@ -70,7 +71,7 @@ struct iiterator
, difference_type , difference_type
, pointer , pointer
, reference , reference
> iterator_traits; > iterator_type;
typedef typename value_traits_pointers typedef typename value_traits_pointers
<ValueTraits>::value_traits_ptr value_traits_ptr; <ValueTraits>::value_traits_ptr value_traits_ptr;
typedef typename value_traits_pointers typedef typename value_traits_pointers
@@ -83,15 +84,15 @@ template<class NodePtr, class StoredPointer, bool StatefulValueTraits = true>
struct iiterator_members struct iiterator_members
{ {
iiterator_members() BOOST_INTRUSIVE_FORCEINLINE iiterator_members()
: nodeptr_()//Value initialization to achieve "null iterators" (N3644) : nodeptr_()//Value initialization to achieve "null iterators" (N3644)
{} {}
iiterator_members(const NodePtr &n_ptr, const StoredPointer &data) BOOST_INTRUSIVE_FORCEINLINE iiterator_members(const NodePtr &n_ptr, const StoredPointer &data)
: nodeptr_(n_ptr), ptr_(data) : nodeptr_(n_ptr), ptr_(data)
{} {}
StoredPointer get_ptr() const BOOST_INTRUSIVE_FORCEINLINE StoredPointer get_ptr() const
{ return ptr_; } { return ptr_; }
NodePtr nodeptr_; NodePtr nodeptr_;
@@ -101,15 +102,15 @@ struct iiterator_members
template<class NodePtr, class StoredPointer> template<class NodePtr, class StoredPointer>
struct iiterator_members<NodePtr, StoredPointer, false> struct iiterator_members<NodePtr, StoredPointer, false>
{ {
iiterator_members() BOOST_INTRUSIVE_FORCEINLINE iiterator_members()
: nodeptr_()//Value initialization to achieve "null iterators" (N3644) : nodeptr_()//Value initialization to achieve "null iterators" (N3644)
{} {}
iiterator_members(const NodePtr &n_ptr, const StoredPointer &) BOOST_INTRUSIVE_FORCEINLINE iiterator_members(const NodePtr &n_ptr, const StoredPointer &)
: nodeptr_(n_ptr) : nodeptr_(n_ptr)
{} {}
StoredPointer get_ptr() const BOOST_INTRUSIVE_FORCEINLINE StoredPointer get_ptr() const
{ return StoredPointer(); } { return StoredPointer(); }
NodePtr nodeptr_; NodePtr nodeptr_;

View File

@@ -23,6 +23,7 @@
#include <cstddef> #include <cstddef>
#include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/std_fwd.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/move/detail/iterator_traits.hpp> #include <boost/move/detail/iterator_traits.hpp>
#include <boost/move/detail/meta_utils_core.hpp> #include <boost/move/detail/meta_utils_core.hpp>
@@ -34,14 +35,14 @@ using boost::movelib::iterator_traits;
//////////////////// ////////////////////
// iterator // iterator
//////////////////// ////////////////////
template<class Category, class T, class Distance, class Pointer = T*, class Reference = T&> template<class Category, class T, class Difference, class Pointer, class Reference>
struct iterator struct iterator
{ {
typedef Category iterator_category; typedef Category iterator_category;
typedef T value_type; typedef T value_type;
typedef Distance difference_type; typedef Difference difference_type;
typedef Pointer pointer; typedef Pointer pointer;
typedef Reference reference; typedef Reference reference;
}; };
//////////////////////////////////////// ////////////////////////////////////////
@@ -83,7 +84,7 @@ struct iterator_disable_if_tag_difference_type
//////////////////// ////////////////////
// advance // advance
//////////////////// ////////////////////
template<class InputIt, class Distance> inline template<class InputIt, class Distance>
typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type
iterator_advance(InputIt& it, Distance n) iterator_advance(InputIt& it, Distance n)
{ {
@@ -91,7 +92,7 @@ typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type
++it; ++it;
} }
template<class InputIt, class Distance> inline template<class InputIt, class Distance>
typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type
iterator_advance(InputIt& it, Distance n) iterator_advance(InputIt& it, Distance n)
{ {
@@ -99,7 +100,7 @@ typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type
++it; ++it;
} }
template<class InputIt, class Distance> inline template<class InputIt, class Distance>
typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type
iterator_advance(InputIt& it, Distance n) iterator_advance(InputIt& it, Distance n)
{ {
@@ -109,8 +110,8 @@ typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type
--it; --it;
} }
template<class InputIt, class Distance> inline template<class InputIt, class Distance>
typename iterator_enable_if_tag<InputIt, std::random_access_iterator_tag>::type BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::random_access_iterator_tag>::type
iterator_advance(InputIt& it, Distance n) iterator_advance(InputIt& it, Distance n)
{ {
it += n; it += n;
@@ -132,8 +133,8 @@ typename iterator_disable_if_tag_difference_type
return off; return off;
} }
template<class InputIt> inline template<class InputIt>
typename iterator_enable_if_tag_difference_type BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag_difference_type
<InputIt, std::random_access_iterator_tag>::type <InputIt, std::random_access_iterator_tag>::type
iterator_distance(InputIt first, InputIt last) iterator_distance(InputIt first, InputIt last)
{ {
@@ -142,11 +143,11 @@ typename iterator_enable_if_tag_difference_type
} }
template<class I> template<class I>
typename iterator_traits<I>::pointer iterator_arrow_result(const I &i) BOOST_INTRUSIVE_FORCEINLINE typename iterator_traits<I>::pointer iterator_arrow_result(const I &i)
{ return i.operator->(); } { return i.operator->(); }
template<class T> template<class T>
T * iterator_arrow_result(T *p) BOOST_INTRUSIVE_FORCEINLINE T * iterator_arrow_result(T *p)
{ return p; } { return p; }
} //namespace intrusive } //namespace intrusive

View File

@@ -22,6 +22,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/std_fwd.hpp>
#include <boost/intrusive/detail/iiterator.hpp> #include <boost/intrusive/detail/iiterator.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
@@ -48,80 +49,80 @@ class list_iterator
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr; typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
public: public:
typedef typename types_t::iterator_traits::difference_type difference_type; typedef typename types_t::iterator_type::difference_type difference_type;
typedef typename types_t::iterator_traits::value_type value_type; typedef typename types_t::iterator_type::value_type value_type;
typedef typename types_t::iterator_traits::pointer pointer; typedef typename types_t::iterator_type::pointer pointer;
typedef typename types_t::iterator_traits::reference reference; typedef typename types_t::iterator_type::reference reference;
typedef typename types_t::iterator_traits::iterator_category iterator_category; typedef typename types_t::iterator_type::iterator_category iterator_category;
list_iterator() BOOST_INTRUSIVE_FORCEINLINE list_iterator()
{} {}
explicit list_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr) BOOST_INTRUSIVE_FORCEINLINE explicit list_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
: members_(nodeptr, traits_ptr) : members_(nodeptr, traits_ptr)
{} {}
list_iterator(list_iterator<ValueTraits, false> const& other) BOOST_INTRUSIVE_FORCEINLINE list_iterator(list_iterator<ValueTraits, false> const& other)
: members_(other.pointed_node(), other.get_value_traits()) : members_(other.pointed_node(), other.get_value_traits())
{} {}
const node_ptr &pointed_node() const BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const
{ return members_.nodeptr_; } { return members_.nodeptr_; }
list_iterator &operator=(const node_ptr &node) BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const node_ptr &node)
{ members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); } { members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); }
const_value_traits_ptr get_value_traits() const BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const
{ return members_.get_ptr(); } { return members_.get_ptr(); }
public: public:
list_iterator& operator++() BOOST_INTRUSIVE_FORCEINLINE list_iterator& operator++()
{ {
node_ptr p = node_traits::get_next(members_.nodeptr_); node_ptr p = node_traits::get_next(members_.nodeptr_);
members_.nodeptr_ = p; members_.nodeptr_ = p;
return static_cast<list_iterator&> (*this); return static_cast<list_iterator&> (*this);
} }
list_iterator operator++(int) BOOST_INTRUSIVE_FORCEINLINE list_iterator operator++(int)
{ {
list_iterator result (*this); list_iterator result (*this);
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
return result; return result;
} }
list_iterator& operator--() BOOST_INTRUSIVE_FORCEINLINE list_iterator& operator--()
{ {
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
return static_cast<list_iterator&> (*this); return static_cast<list_iterator&> (*this);
} }
list_iterator operator--(int) BOOST_INTRUSIVE_FORCEINLINE list_iterator operator--(int)
{ {
list_iterator result (*this); list_iterator result (*this);
members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_);
return result; return result;
} }
friend bool operator== (const list_iterator& l, const list_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator== (const list_iterator& l, const list_iterator& r)
{ return l.pointed_node() == r.pointed_node(); } { return l.pointed_node() == r.pointed_node(); }
friend bool operator!= (const list_iterator& l, const list_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator!= (const list_iterator& l, const list_iterator& r)
{ return !(l == r); } { return !(l == r); }
reference operator*() const BOOST_INTRUSIVE_FORCEINLINE reference operator*() const
{ return *operator->(); } { return *operator->(); }
pointer operator->() const BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const
{ return this->operator_arrow(detail::bool_<stateful_value_traits>()); } { return this->operator_arrow(detail::bool_<stateful_value_traits>()); }
list_iterator<ValueTraits, false> unconst() const list_iterator<ValueTraits, false> unconst() const
{ return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); } { return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
private: private:
pointer operator_arrow(detail::false_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const
{ return ValueTraits::to_value_ptr(members_.nodeptr_); } { return ValueTraits::to_value_ptr(members_.nodeptr_); }
pointer operator_arrow(detail::true_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::true_) const
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); } { return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;

View File

@@ -22,6 +22,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
namespace boost { namespace boost {
@@ -46,22 +47,22 @@ struct list_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr; typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
static node_ptr get_previous(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const const_node_ptr & n)
{ return n->prev_; } { return n->prev_; }
static node_ptr get_previous(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const node_ptr & n)
{ return n->prev_; } { return n->prev_; }
static void set_previous(const node_ptr & n, const node_ptr & prev) BOOST_INTRUSIVE_FORCEINLINE static void set_previous(const node_ptr & n, const node_ptr & prev)
{ n->prev_ = prev; } { n->prev_ = prev; }
static node_ptr get_next(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n)
{ return n->next_; } { return n->next_; }
static node_ptr get_next(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n)
{ return n->next_; } { return n->next_; }
static void set_next(const node_ptr & n, const node_ptr & next) BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next_ = next; } { n->next_ = next; }
}; };

View File

@@ -21,6 +21,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <cstddef> #include <cstddef>
#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL)) #if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))
@@ -33,7 +34,7 @@ namespace intrusive {
namespace detail { namespace detail {
template<class Parent, class Member> template<class Parent, class Member>
inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member) BOOST_INTRUSIVE_FORCEINLINE std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_to_member)
{ {
//The implementation of a pointer to member is compiler dependent. //The implementation of a pointer to member is compiler dependent.
#if defined(BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER) #if defined(BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER)
@@ -88,7 +89,7 @@ inline std::ptrdiff_t offset_from_pointer_to_member(const Member Parent::* ptr_t
} }
template<class Parent, class Member> template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member) BOOST_INTRUSIVE_FORCEINLINE Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{ {
return static_cast<Parent*> return static_cast<Parent*>
( (
@@ -100,7 +101,7 @@ inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_
} }
template<class Parent, class Member> template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member) BOOST_INTRUSIVE_FORCEINLINE const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{ {
return static_cast<const Parent*> return static_cast<const Parent*>
( (

View File

@@ -23,6 +23,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
#include <boost/intrusive/rbtree_algorithms.hpp> #include <boost/intrusive/rbtree_algorithms.hpp>
#include <boost/intrusive/pointer_plus_bits.hpp> #include <boost/intrusive/pointer_plus_bits.hpp>
@@ -73,46 +74,46 @@ struct default_rbtree_node_traits_impl
typedef typename node::color color; typedef typename node::color color;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static node_ptr get_parent(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static node_ptr get_left(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static node_ptr get_right(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; } { n->right_ = r; }
static color get_color(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n)
{ return n->color_; } { return n->color_; }
static color get_color(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static color get_color(const node_ptr & n)
{ return n->color_; } { return n->color_; }
static void set_color(const node_ptr & n, color c) BOOST_INTRUSIVE_FORCEINLINE static void set_color(const node_ptr & n, color c)
{ n->color_ = c; } { n->color_ = c; }
static color black() BOOST_INTRUSIVE_FORCEINLINE static color black()
{ return node::black_t; } { return node::black_t; }
static color red() BOOST_INTRUSIVE_FORCEINLINE static color red()
{ return node::red_t; } { return node::red_t; }
}; };
@@ -129,46 +130,46 @@ struct compact_rbtree_node_traits_impl
typedef typename node::color color; typedef typename node::color color;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return ptr_bit::get_pointer(n->parent_); } { return ptr_bit::get_pointer(n->parent_); }
static node_ptr get_parent(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
{ return ptr_bit::get_pointer(n->parent_); } { return ptr_bit::get_pointer(n->parent_); }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); } { ptr_bit::set_pointer(n->parent_, p); }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static node_ptr get_left(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static node_ptr get_right(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; } { n->right_ = r; }
static color get_color(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n)
{ return (color)ptr_bit::get_bits(n->parent_); } { return (color)ptr_bit::get_bits(n->parent_); }
static color get_color(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static color get_color(const node_ptr & n)
{ return (color)ptr_bit::get_bits(n->parent_); } { return (color)ptr_bit::get_bits(n->parent_); }
static void set_color(const node_ptr & n, color c) BOOST_INTRUSIVE_FORCEINLINE static void set_color(const node_ptr & n, color c)
{ ptr_bit::set_bits(n->parent_, c != 0); } { ptr_bit::set_bits(n->parent_, c != 0); }
static color black() BOOST_INTRUSIVE_FORCEINLINE static color black()
{ return node::black_t; } { return node::black_t; }
static color red() BOOST_INTRUSIVE_FORCEINLINE static color red()
{ return node::red_t; } { return node::red_t; }
}; };

View File

@@ -43,12 +43,16 @@ class reverse_iterator
reverse_iterator() reverse_iterator()
: m_current() //Value initialization to achieve "null iterators" (N3644) : m_current() //Value initialization to achieve "null iterators" (N3644)
{} {}
explicit reverse_iterator(It r) explicit reverse_iterator(It r)
: m_current(r) : m_current(r)
{} {}
reverse_iterator(const reverse_iterator& r)
: m_current(r.base())
{}
template<class OtherIt> template<class OtherIt>
reverse_iterator( const reverse_iterator<OtherIt>& r reverse_iterator( const reverse_iterator<OtherIt>& r
, typename boost::intrusive::detail::enable_if_convertible<OtherIt, It>::type* =0 , typename boost::intrusive::detail::enable_if_convertible<OtherIt, It>::type* =0
@@ -56,6 +60,9 @@ class reverse_iterator
: m_current(r.base()) : m_current(r.base())
{} {}
reverse_iterator & operator=( const reverse_iterator& r)
{ m_current = r.base(); return *this; }
template<class OtherIt> template<class OtherIt>
typename boost::intrusive::detail::enable_if_convertible<OtherIt, It, reverse_iterator &>::type typename boost::intrusive::detail::enable_if_convertible<OtherIt, It, reverse_iterator &>::type
operator=( const reverse_iterator<OtherIt>& r) operator=( const reverse_iterator<OtherIt>& r)
@@ -65,20 +72,34 @@ class reverse_iterator
{ return m_current; } { return m_current; }
reference operator*() const reference operator*() const
{ It temp(m_current); --temp; return *temp; } {
It temp(m_current);
--temp;
reference r = *temp;
return r;
}
pointer operator->() const pointer operator->() const
{ It temp(m_current); --temp; return iterator_arrow_result(temp); } {
It temp(m_current);
--temp;
return iterator_arrow_result(temp);
}
reference operator[](difference_type off) const reference operator[](difference_type off) const
{ return this->m_current[-off - 1]; } {
return this->m_current[-off - 1];
}
reverse_iterator& operator++() reverse_iterator& operator++()
{ --m_current; return *this; } {
--m_current;
return *this;
}
reverse_iterator operator++(int) reverse_iterator operator++(int)
{ {
reverse_iterator temp = *this; reverse_iterator temp((*this));
--m_current; --m_current;
return temp; return temp;
} }
@@ -91,7 +112,7 @@ class reverse_iterator
reverse_iterator operator--(int) reverse_iterator operator--(int)
{ {
reverse_iterator temp(*this); reverse_iterator temp((*this));
++m_current; ++m_current;
return temp; return temp;
} }
@@ -117,17 +138,17 @@ class reverse_iterator
reverse_iterator& operator+=(difference_type off) reverse_iterator& operator+=(difference_type off)
{ m_current -= off; return *this; } { m_current -= off; return *this; }
reverse_iterator& operator-=(difference_type off)
{ m_current += off; return *this; }
friend reverse_iterator operator+(reverse_iterator l, difference_type off) friend reverse_iterator operator+(reverse_iterator l, difference_type off)
{ l.m_current -= off; return l; } { return (l += off); }
friend reverse_iterator operator+(difference_type off, reverse_iterator r) friend reverse_iterator operator+(difference_type off, reverse_iterator r)
{ return (r += off); } { return (r += off); }
reverse_iterator& operator-=(difference_type off)
{ m_current += off; return *this; }
friend reverse_iterator operator-(reverse_iterator l, difference_type off) friend reverse_iterator operator-(reverse_iterator l, difference_type off)
{ l.m_current += off; return l; } { return (l-= off); }
friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r) friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r)
{ return r.m_current - l.m_current; } { return r.m_current - l.m_current; }

View File

@@ -21,6 +21,8 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
namespace boost { namespace boost {
namespace intrusive { namespace intrusive {
namespace detail { namespace detail {
@@ -31,22 +33,22 @@ struct size_holder
static const bool constant_time_size = ConstantSize; static const bool constant_time_size = ConstantSize;
typedef SizeType size_type; typedef SizeType size_type;
SizeType get_size() const BOOST_INTRUSIVE_FORCEINLINE SizeType get_size() const
{ return size_; } { return size_; }
void set_size(SizeType size) BOOST_INTRUSIVE_FORCEINLINE void set_size(SizeType size)
{ size_ = size; } { size_ = size; }
void decrement() BOOST_INTRUSIVE_FORCEINLINE void decrement()
{ --size_; } { --size_; }
void increment() BOOST_INTRUSIVE_FORCEINLINE void increment()
{ ++size_; } { ++size_; }
void increase(SizeType n) BOOST_INTRUSIVE_FORCEINLINE void increase(SizeType n)
{ size_ += n; } { size_ += n; }
void decrease(SizeType n) BOOST_INTRUSIVE_FORCEINLINE void decrease(SizeType n)
{ size_ -= n; } { size_ -= n; }
SizeType size_; SizeType size_;
@@ -58,22 +60,22 @@ struct size_holder<false, SizeType, Tag>
static const bool constant_time_size = false; static const bool constant_time_size = false;
typedef SizeType size_type; typedef SizeType size_type;
size_type get_size() const BOOST_INTRUSIVE_FORCEINLINE size_type get_size() const
{ return 0; } { return 0; }
void set_size(size_type) BOOST_INTRUSIVE_FORCEINLINE void set_size(size_type)
{} {}
void decrement() BOOST_INTRUSIVE_FORCEINLINE void decrement()
{} {}
void increment() BOOST_INTRUSIVE_FORCEINLINE void increment()
{} {}
void increase(SizeType) BOOST_INTRUSIVE_FORCEINLINE void increase(SizeType)
{} {}
void decrease(SizeType) BOOST_INTRUSIVE_FORCEINLINE void decrease(SizeType)
{} {}
}; };

View File

@@ -23,6 +23,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/std_fwd.hpp>
#include <boost/intrusive/detail/iiterator.hpp> #include <boost/intrusive/detail/iiterator.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
@@ -50,67 +51,67 @@ class slist_iterator
typedef typename types_t::const_value_traits_ptr const_value_traits_ptr; typedef typename types_t::const_value_traits_ptr const_value_traits_ptr;
public: public:
typedef typename types_t::iterator_traits::difference_type difference_type; typedef typename types_t::iterator_type::difference_type difference_type;
typedef typename types_t::iterator_traits::value_type value_type; typedef typename types_t::iterator_type::value_type value_type;
typedef typename types_t::iterator_traits::pointer pointer; typedef typename types_t::iterator_type::pointer pointer;
typedef typename types_t::iterator_traits::reference reference; typedef typename types_t::iterator_type::reference reference;
typedef typename types_t::iterator_traits::iterator_category iterator_category; typedef typename types_t::iterator_type::iterator_category iterator_category;
slist_iterator() BOOST_INTRUSIVE_FORCEINLINE slist_iterator()
{} {}
explicit slist_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr) BOOST_INTRUSIVE_FORCEINLINE explicit slist_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
: members_(nodeptr, traits_ptr) : members_(nodeptr, traits_ptr)
{} {}
slist_iterator(slist_iterator<ValueTraits, false> const& other) BOOST_INTRUSIVE_FORCEINLINE slist_iterator(slist_iterator<ValueTraits, false> const& other)
: members_(other.pointed_node(), other.get_value_traits()) : members_(other.pointed_node(), other.get_value_traits())
{} {}
const node_ptr &pointed_node() const BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const
{ return members_.nodeptr_; } { return members_.nodeptr_; }
slist_iterator &operator=(const node_ptr &node) BOOST_INTRUSIVE_FORCEINLINE slist_iterator &operator=(const node_ptr &node)
{ members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); } { members_.nodeptr_ = node; return static_cast<slist_iterator&>(*this); }
const_value_traits_ptr get_value_traits() const BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const
{ return members_.get_ptr(); } { return members_.get_ptr(); }
public: public:
slist_iterator& operator++() BOOST_INTRUSIVE_FORCEINLINE slist_iterator& operator++()
{ {
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
return static_cast<slist_iterator&> (*this); return static_cast<slist_iterator&> (*this);
} }
slist_iterator operator++(int) BOOST_INTRUSIVE_FORCEINLINE slist_iterator operator++(int)
{ {
slist_iterator result (*this); slist_iterator result (*this);
members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_);
return result; return result;
} }
friend bool operator== (const slist_iterator& l, const slist_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator== (const slist_iterator& l, const slist_iterator& r)
{ return l.pointed_node() == r.pointed_node(); } { return l.pointed_node() == r.pointed_node(); }
friend bool operator!= (const slist_iterator& l, const slist_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator!= (const slist_iterator& l, const slist_iterator& r)
{ return !(l == r); } { return !(l == r); }
reference operator*() const BOOST_INTRUSIVE_FORCEINLINE reference operator*() const
{ return *operator->(); } { return *operator->(); }
pointer operator->() const BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const
{ return this->operator_arrow(detail::bool_<stateful_value_traits>()); } { return this->operator_arrow(detail::bool_<stateful_value_traits>()); }
slist_iterator<ValueTraits, false> unconst() const BOOST_INTRUSIVE_FORCEINLINE slist_iterator<ValueTraits, false> unconst() const
{ return slist_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); } { return slist_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); }
private: private:
pointer operator_arrow(detail::false_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const
{ return ValueTraits::to_value_ptr(members_.nodeptr_); } { return ValueTraits::to_value_ptr(members_.nodeptr_); }
pointer operator_arrow(detail::true_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::true_) const
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); } { return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;

View File

@@ -23,6 +23,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
namespace boost { namespace boost {
@@ -45,13 +46,13 @@ struct slist_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr; typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
static node_ptr get_next(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n)
{ return n->next_; } { return n->next_; }
static node_ptr get_next(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n)
{ return n->next_; } { return n->next_; }
static void set_next(const node_ptr & n, const node_ptr & next) BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next_ = next; } { n->next_ = next; }
}; };

View File

@@ -22,6 +22,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/pointer_element.hpp> #include <boost/intrusive/detail/pointer_element.hpp>
namespace boost { namespace boost {
@@ -29,11 +30,11 @@ namespace intrusive {
namespace detail { namespace detail {
template <class T> template <class T>
inline T* to_raw_pointer(T* p) BOOST_INTRUSIVE_FORCEINLINE T* to_raw_pointer(T* p)
{ return p; } { return p; }
template <class Pointer> template <class Pointer>
inline typename boost::intrusive::pointer_element<Pointer>::type* BOOST_INTRUSIVE_FORCEINLINE typename boost::intrusive::pointer_element<Pointer>::type*
to_raw_pointer(const Pointer &p) to_raw_pointer(const Pointer &p)
{ return boost::intrusive::detail::to_raw_pointer(p.operator->()); } { return boost::intrusive::detail::to_raw_pointer(p.operator->()); }

View File

@@ -22,6 +22,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/iterator.hpp> #include <boost/intrusive/detail/iterator.hpp>
@@ -32,11 +33,11 @@ namespace detail {
template <class PseudoReference> template <class PseudoReference>
struct operator_arrow_proxy struct operator_arrow_proxy
{ {
operator_arrow_proxy(const PseudoReference &px) BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy(const PseudoReference &px)
: m_value(px) : m_value(px)
{} {}
PseudoReference* operator->() const { return &m_value; } BOOST_INTRUSIVE_FORCEINLINE PseudoReference* operator->() const { return &m_value; }
// This function is needed for MWCW and BCC, which won't call operator-> // This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8 // again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; } // operator T*() const { return &m_value; }
@@ -46,11 +47,11 @@ struct operator_arrow_proxy
template <class T> template <class T>
struct operator_arrow_proxy<T&> struct operator_arrow_proxy<T&>
{ {
operator_arrow_proxy(T &px) BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy(T &px)
: m_value(px) : m_value(px)
{} {}
T* operator->() const { return &m_value; } BOOST_INTRUSIVE_FORCEINLINE T* operator->() const { return &m_value; }
// This function is needed for MWCW and BCC, which won't call operator-> // This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8 // again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; } // operator T*() const { return &m_value; }
@@ -75,53 +76,53 @@ class transform_iterator
: members_() : members_()
{} {}
Iterator get_it() const BOOST_INTRUSIVE_FORCEINLINE Iterator get_it() const
{ return members_.m_it; } { return members_.m_it; }
//Constructors //Constructors
transform_iterator& operator++() BOOST_INTRUSIVE_FORCEINLINE transform_iterator& operator++()
{ increment(); return *this; } { increment(); return *this; }
transform_iterator operator++(int) BOOST_INTRUSIVE_FORCEINLINE transform_iterator operator++(int)
{ {
transform_iterator result (*this); transform_iterator result (*this);
increment(); increment();
return result; return result;
} }
friend bool operator== (const transform_iterator& i, const transform_iterator& i2) BOOST_INTRUSIVE_FORCEINLINE friend bool operator== (const transform_iterator& i, const transform_iterator& i2)
{ return i.equal(i2); } { return i.equal(i2); }
friend bool operator!= (const transform_iterator& i, const transform_iterator& i2) BOOST_INTRUSIVE_FORCEINLINE friend bool operator!= (const transform_iterator& i, const transform_iterator& i2)
{ return !(i == i2); } { return !(i == i2); }
friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2) BOOST_INTRUSIVE_FORCEINLINE friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
{ return i2.distance_to(i); } { return i2.distance_to(i); }
//Arithmetic //Arithmetic
transform_iterator& operator+=(typename Iterator::difference_type off) transform_iterator& operator+=(typename Iterator::difference_type off)
{ this->advance(off); return *this; } { this->advance(off); return *this; }
transform_iterator operator+(typename Iterator::difference_type off) const BOOST_INTRUSIVE_FORCEINLINE transform_iterator operator+(typename Iterator::difference_type off) const
{ {
transform_iterator other(*this); transform_iterator other(*this);
other.advance(off); other.advance(off);
return other; return other;
} }
friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right) BOOST_INTRUSIVE_FORCEINLINE friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right)
{ return right + off; } { return right + off; }
transform_iterator& operator-=(typename Iterator::difference_type off) BOOST_INTRUSIVE_FORCEINLINE transform_iterator& operator-=(typename Iterator::difference_type off)
{ this->advance(-off); return *this; } { this->advance(-off); return *this; }
transform_iterator operator-(typename Iterator::difference_type off) const BOOST_INTRUSIVE_FORCEINLINE transform_iterator operator-(typename Iterator::difference_type off) const
{ return *this + (-off); } { return *this + (-off); }
typename UnaryFunction::result_type operator*() const BOOST_INTRUSIVE_FORCEINLINE typename UnaryFunction::result_type operator*() const
{ return dereference(); } { return dereference(); }
operator_arrow_proxy<typename UnaryFunction::result_type> BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy<typename UnaryFunction::result_type>
operator->() const operator->() const
{ return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); } { return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); }
@@ -129,27 +130,27 @@ class transform_iterator
struct members struct members
: UnaryFunction : UnaryFunction
{ {
members(const Iterator &it, const UnaryFunction &f) BOOST_INTRUSIVE_FORCEINLINE members(const Iterator &it, const UnaryFunction &f)
: UnaryFunction(f), m_it(it) : UnaryFunction(f), m_it(it)
{} {}
members() BOOST_INTRUSIVE_FORCEINLINE members()
{} {}
Iterator m_it; Iterator m_it;
} members_; } members_;
void increment() BOOST_INTRUSIVE_FORCEINLINE void increment()
{ ++members_.m_it; } { ++members_.m_it; }
void decrement() BOOST_INTRUSIVE_FORCEINLINE void decrement()
{ --members_.m_it; } { --members_.m_it; }
bool equal(const transform_iterator &other) const BOOST_INTRUSIVE_FORCEINLINE bool equal(const transform_iterator &other) const
{ return members_.m_it == other.members_.m_it; } { return members_.m_it == other.members_.m_it; }
bool less(const transform_iterator &other) const BOOST_INTRUSIVE_FORCEINLINE bool less(const transform_iterator &other) const
{ return other.members_.m_it < members_.m_it; } { return other.members_.m_it < members_.m_it; }
typename UnaryFunction::result_type dereference() const typename UnaryFunction::result_type dereference() const

View File

@@ -22,6 +22,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/std_fwd.hpp>
#include <boost/intrusive/detail/iiterator.hpp> #include <boost/intrusive/detail/iiterator.hpp>
#include <boost/intrusive/detail/bstree_algorithms_base.hpp> #include <boost/intrusive/detail/bstree_algorithms_base.hpp>
@@ -56,27 +57,27 @@ class tree_iterator
typedef void (tree_iterator::*unspecified_bool_type)() const; typedef void (tree_iterator::*unspecified_bool_type)() const;
public: public:
typedef typename types_t::iterator_traits::difference_type difference_type; typedef typename types_t::iterator_type::difference_type difference_type;
typedef typename types_t::iterator_traits::value_type value_type; typedef typename types_t::iterator_type::value_type value_type;
typedef typename types_t::iterator_traits::pointer pointer; typedef typename types_t::iterator_type::pointer pointer;
typedef typename types_t::iterator_traits::reference reference; typedef typename types_t::iterator_type::reference reference;
typedef typename types_t::iterator_traits::iterator_category iterator_category; typedef typename types_t::iterator_type::iterator_category iterator_category;
tree_iterator() BOOST_INTRUSIVE_FORCEINLINE tree_iterator()
{} {}
explicit tree_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr) BOOST_INTRUSIVE_FORCEINLINE explicit tree_iterator(const node_ptr & nodeptr, const const_value_traits_ptr &traits_ptr)
: members_(nodeptr, traits_ptr) : members_(nodeptr, traits_ptr)
{} {}
tree_iterator(tree_iterator<value_traits, false> const& other) BOOST_INTRUSIVE_FORCEINLINE tree_iterator(tree_iterator<value_traits, false> const& other)
: members_(other.pointed_node(), other.get_value_traits()) : members_(other.pointed_node(), other.get_value_traits())
{} {}
const node_ptr &pointed_node() const BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const
{ return members_.nodeptr_; } { return members_.nodeptr_; }
tree_iterator &operator=(const node_ptr &nodeptr) BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const node_ptr &nodeptr)
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); } { members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
public: public:
@@ -106,43 +107,43 @@ class tree_iterator
return result; return result;
} }
tree_iterator& go_left() BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_left()
{ {
members_.nodeptr_ = node_traits::get_left(members_.nodeptr_); members_.nodeptr_ = node_traits::get_left(members_.nodeptr_);
return static_cast<tree_iterator&> (*this); return static_cast<tree_iterator&> (*this);
} }
tree_iterator& go_right() BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_right()
{ {
members_.nodeptr_ = node_traits::get_right(members_.nodeptr_); members_.nodeptr_ = node_traits::get_right(members_.nodeptr_);
return static_cast<tree_iterator&> (*this); return static_cast<tree_iterator&> (*this);
} }
tree_iterator& go_parent() BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_parent()
{ {
members_.nodeptr_ = node_traits::get_parent(members_.nodeptr_); members_.nodeptr_ = node_traits::get_parent(members_.nodeptr_);
return static_cast<tree_iterator&> (*this); return static_cast<tree_iterator&> (*this);
} }
operator unspecified_bool_type() const BOOST_INTRUSIVE_FORCEINLINE operator unspecified_bool_type() const
{ return members_.nodeptr_ ? &tree_iterator::unspecified_bool_type_func : 0; } { return members_.nodeptr_ ? &tree_iterator::unspecified_bool_type_func : 0; }
bool operator! () const BOOST_INTRUSIVE_FORCEINLINE bool operator! () const
{ return !members_.nodeptr_; } { return !members_.nodeptr_; }
friend bool operator== (const tree_iterator& l, const tree_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator== (const tree_iterator& l, const tree_iterator& r)
{ return l.pointed_node() == r.pointed_node(); } { return l.pointed_node() == r.pointed_node(); }
friend bool operator!= (const tree_iterator& l, const tree_iterator& r) BOOST_INTRUSIVE_FORCEINLINE friend bool operator!= (const tree_iterator& l, const tree_iterator& r)
{ return !(l == r); } { return !(l == r); }
reference operator*() const BOOST_INTRUSIVE_FORCEINLINE reference operator*() const
{ return *operator->(); } { return *operator->(); }
pointer operator->() const BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const
{ return this->operator_arrow(detail::bool_<stateful_value_traits>()); } { return this->operator_arrow(detail::bool_<stateful_value_traits>()); }
const_value_traits_ptr get_value_traits() const BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const
{ return members_.get_ptr(); } { return members_.get_ptr(); }
tree_iterator end_iterator_from_it() const tree_iterator end_iterator_from_it() const
@@ -154,10 +155,10 @@ class tree_iterator
{ return tree_iterator<value_traits, false>(this->pointed_node(), this->get_value_traits()); } { return tree_iterator<value_traits, false>(this->pointed_node(), this->get_value_traits()); }
private: private:
pointer operator_arrow(detail::false_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const
{ return ValueTraits::to_value_ptr(members_.nodeptr_); } { return ValueTraits::to_value_ptr(members_.nodeptr_); }
pointer operator_arrow(detail::true_) const BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::true_) const
{ return this->get_value_traits()->to_value_ptr(members_.nodeptr_); } { return this->get_value_traits()->to_value_ptr(members_.nodeptr_); }
iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_;

View File

@@ -22,6 +22,7 @@
#endif #endif
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/pointer_rebind.hpp>
namespace boost { namespace boost {
@@ -43,31 +44,31 @@ struct tree_node_traits
typedef typename node::node_ptr node_ptr; typedef typename node::node_ptr node_ptr;
typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr; typedef typename pointer_rebind<VoidPointer, const node>::type const_node_ptr;
static node_ptr get_parent(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static node_ptr get_parent(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n)
{ return n->parent_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static node_ptr get_left(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static node_ptr get_right(const node_ptr & n) BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; } { n->right_ = r; }
}; };

View File

@@ -18,6 +18,7 @@
# pragma once # pragma once
#endif #endif
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/detail/ebo_functor_holder.hpp> #include <boost/intrusive/detail/ebo_functor_holder.hpp>
@@ -53,10 +54,10 @@ struct tree_value_compare
tree_value_compare &operator=(const key_compare &x) tree_value_compare &operator=(const key_compare &x)
{ this->base_t::get() = x; return *this; } { this->base_t::get() = x; return *this; }
const key_compare &key_comp() const BOOST_INTRUSIVE_FORCEINLINE const key_compare &key_comp() const
{ return static_cast<const key_compare &>(*this); } { return static_cast<const key_compare &>(*this); }
key_compare &key_comp() BOOST_INTRUSIVE_FORCEINLINE key_compare &key_comp()
{ return static_cast<key_compare &>(*this); } { return static_cast<key_compare &>(*this); }
template<class U> template<class U>
@@ -70,16 +71,16 @@ struct tree_value_compare
{ return key; } { return key; }
template<class U> template<class U>
const key_type & key_forward BOOST_INTRUSIVE_FORCEINLINE const key_type & key_forward
(const U &key, typename boost::intrusive::detail::disable_if<is_key<U> >::type* = 0) const (const U &key, typename boost::intrusive::detail::disable_if<is_key<U> >::type* = 0) const
{ return KeyOfValue()(key); } { return KeyOfValue()(key); }
template<class KeyType, class KeyType2> template<class KeyType, class KeyType2>
bool operator()(const KeyType &key1, const KeyType2 &key2) const BOOST_INTRUSIVE_FORCEINLINE bool operator()(const KeyType &key1, const KeyType2 &key2) const
{ return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); } { return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
template<class KeyType, class KeyType2> template<class KeyType, class KeyType2>
bool operator()(const KeyType &key1, const KeyType2 &key2) BOOST_INTRUSIVE_FORCEINLINE bool operator()(const KeyType &key1, const KeyType2 &key2)
{ return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); } { return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
}; };

View File

@@ -34,5 +34,17 @@
#define BOOST_INTRUSIVE_I , #define BOOST_INTRUSIVE_I ,
#define BOOST_INTRUSIVE_DOCIGN(T1) T1 #define BOOST_INTRUSIVE_DOCIGN(T1) T1
#define BOOST_INTRUSIVE_DISABLE_FORCEINLINE
#if defined(BOOST_INTRUSIVE_DISABLE_FORCEINLINE)
#define BOOST_INTRUSIVE_FORCEINLINE inline
#elif defined(BOOST_INTRUSIVE_FORCEINLINE_IS_BOOST_FORCELINE)
#define BOOST_INTRUSIVE_FORCEINLINE BOOST_FORCEINLINE
#elif defined(BOOST_MSVC) && defined(_DEBUG)
//"__forceinline" and MSVC seems to have some bugs in debug mode
#define BOOST_INTRUSIVE_FORCEINLINE inline
#else
#define BOOST_INTRUSIVE_FORCEINLINE BOOST_FORCEINLINE
#endif
#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP #endif //#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP

View File

@@ -56,19 +56,19 @@ struct member_value_traits
typedef const value_type & const_reference; typedef const value_type & const_reference;
static const link_mode_type link_mode = LinkMode; static const link_mode_type link_mode = LinkMode;
static node_ptr to_node_ptr(reference value) BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value)
{ return pointer_traits<node_ptr>::pointer_to(value.*PtrToMember); } { return pointer_traits<node_ptr>::pointer_to(value.*PtrToMember); }
static const_node_ptr to_node_ptr(const_reference value) BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value)
{ return pointer_traits<const_node_ptr>::pointer_to(value.*PtrToMember); } { return pointer_traits<const_node_ptr>::pointer_to(value.*PtrToMember); }
static pointer to_value_ptr(const node_ptr &n) BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr &n)
{ {
return pointer_traits<pointer>::pointer_to(*detail::parent_from_member<value_type, node> return pointer_traits<pointer>::pointer_to(*detail::parent_from_member<value_type, node>
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember)); (boost::intrusive::detail::to_raw_pointer(n), PtrToMember));
} }
static const_pointer to_value_ptr(const const_node_ptr &n) BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr &n)
{ {
return pointer_traits<const_pointer>::pointer_to(*detail::parent_from_member<value_type, node> return pointer_traits<const_pointer>::pointer_to(*detail::parent_from_member<value_type, node>
(boost::intrusive::detail::to_raw_pointer(n), PtrToMember)); (boost::intrusive::detail::to_raw_pointer(n), PtrToMember));

View File

@@ -13,6 +13,7 @@
#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP #define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/intrusive_fwd.hpp> #include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/parent_from_member.hpp> #include <boost/intrusive/detail/parent_from_member.hpp>
@@ -29,7 +30,7 @@ namespace intrusive {
//! Note: this function does not work with pointer to members that rely on //! Note: this function does not work with pointer to members that rely on
//! virtual inheritance. //! virtual inheritance.
template<class Parent, class Member> template<class Parent, class Member>
inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member) BOOST_INTRUSIVE_FORCEINLINE Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
//! Given a const pointer to a member and its corresponding const pointer to data member, //! Given a const pointer to a member and its corresponding const pointer to data member,
@@ -37,7 +38,7 @@ inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr
//! Note: this function does not work with pointer to members that rely on //! Note: this function does not work with pointer to members that rely on
//! virtual inheritance. //! virtual inheritance.
template<class Parent, class Member> template<class Parent, class Member>
inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member) BOOST_INTRUSIVE_FORCEINLINE const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); } { return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
} //namespace intrusive { } //namespace intrusive {

View File

@@ -67,19 +67,19 @@ struct pointer_plus_bits<T*, NumBits>
static const uintptr_t Mask = uintptr_t((uintptr_t(1u) << NumBits) - 1); static const uintptr_t Mask = uintptr_t((uintptr_t(1u) << NumBits) - 1);
typedef T* pointer; typedef T* pointer;
static pointer get_pointer(pointer n) BOOST_INTRUSIVE_FORCEINLINE static pointer get_pointer(pointer n)
{ return pointer(uintptr_t(n) & uintptr_t(~Mask)); } { return pointer(uintptr_t(n) & uintptr_t(~Mask)); }
static void set_pointer(pointer &n, pointer p) BOOST_INTRUSIVE_FORCEINLINE static void set_pointer(pointer &n, pointer p)
{ {
BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (uintptr_t(p) & Mask)); BOOST_INTRUSIVE_INVARIANT_ASSERT(0 == (uintptr_t(p) & Mask));
n = pointer(uintptr_t(p) | (uintptr_t(n) & Mask)); n = pointer(uintptr_t(p) | (uintptr_t(n) & Mask));
} }
static std::size_t get_bits(pointer n) BOOST_INTRUSIVE_FORCEINLINE static std::size_t get_bits(pointer n)
{ return std::size_t(uintptr_t(n) & Mask); } { return std::size_t(uintptr_t(n) & Mask); }
static void set_bits(pointer &n, std::size_t c) BOOST_INTRUSIVE_FORCEINLINE static void set_bits(pointer &n, std::size_t c)
{ {
BOOST_INTRUSIVE_INVARIANT_ASSERT(uintptr_t(c) <= Mask); BOOST_INTRUSIVE_INVARIANT_ASSERT(uintptr_t(c) <= Mask);
n = pointer(uintptr_t((get_pointer)(n)) | uintptr_t(c)); n = pointer(uintptr_t((get_pointer)(n)) | uintptr_t(c));

View File

@@ -288,25 +288,25 @@ struct pointer_traits<T*>
//! <b>Returns</b>: addressof(r) //! <b>Returns</b>: addressof(r)
//! //!
static pointer pointer_to(reference r) BOOST_INTRUSIVE_FORCEINLINE static pointer pointer_to(reference r)
{ return boost::intrusive::detail::addressof(r); } { return boost::intrusive::detail::addressof(r); }
//! <b>Returns</b>: static_cast<pointer>(uptr) //! <b>Returns</b>: static_cast<pointer>(uptr)
//! //!
template<class U> template<class U>
static pointer static_cast_from(U *uptr) BOOST_INTRUSIVE_FORCEINLINE static pointer static_cast_from(U *uptr)
{ return static_cast<pointer>(uptr); } { return static_cast<pointer>(uptr); }
//! <b>Returns</b>: const_cast<pointer>(uptr) //! <b>Returns</b>: const_cast<pointer>(uptr)
//! //!
template<class U> template<class U>
static pointer const_cast_from(U *uptr) BOOST_INTRUSIVE_FORCEINLINE static pointer const_cast_from(U *uptr)
{ return const_cast<pointer>(uptr); } { return const_cast<pointer>(uptr); }
//! <b>Returns</b>: dynamic_cast<pointer>(uptr) //! <b>Returns</b>: dynamic_cast<pointer>(uptr)
//! //!
template<class U> template<class U>
static pointer dynamic_cast_from(U *uptr) BOOST_INTRUSIVE_FORCEINLINE static pointer dynamic_cast_from(U *uptr)
{ return dynamic_cast<pointer>(uptr); } { return dynamic_cast<pointer>(uptr); }
}; };

View File

@@ -14,6 +14,7 @@
#define BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP #define BOOST_INTRUSIVE_PRIORITY_COMPARE_HPP
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/intrusive_fwd.hpp> #include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/minimal_less_equal_header.hpp> #include <boost/intrusive/detail/minimal_less_equal_header.hpp>
@@ -33,7 +34,7 @@ struct priority_compare
typedef T second_argument_type; typedef T second_argument_type;
typedef bool result_type; typedef bool result_type;
bool operator()(const T &val, const T &val2) const BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T &val, const T &val2) const
{ {
return priority_order(val, val2); return priority_order(val, val2);
} }

View File

@@ -14,6 +14,7 @@
#define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP #define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/intrusive_fwd.hpp> #include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/link_mode.hpp> #include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
@@ -42,12 +43,12 @@ struct trivial_value_traits
typedef node_ptr pointer; typedef node_ptr pointer;
typedef const_node_ptr const_pointer; typedef const_node_ptr const_pointer;
static const link_mode_type link_mode = LinkMode; static const link_mode_type link_mode = LinkMode;
static node_ptr to_node_ptr (value_type &value) BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr (value_type &value)
{ return pointer_traits<node_ptr>::pointer_to(value); } { return pointer_traits<node_ptr>::pointer_to(value); }
static const_node_ptr to_node_ptr (const value_type &value) BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr (const value_type &value)
{ return pointer_traits<const_node_ptr>::pointer_to(value); } { return pointer_traits<const_node_ptr>::pointer_to(value); }
static const pointer & to_value_ptr(const node_ptr &n) { return n; } BOOST_INTRUSIVE_FORCEINLINE static const pointer & to_value_ptr(const node_ptr &n) { return n; }
static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; } BOOST_INTRUSIVE_FORCEINLINE static const const_pointer &to_value_ptr(const const_node_ptr &n) { return n; }
}; };
} //namespace intrusive } //namespace intrusive