diff options
Diffstat (limited to 'boost/intrusive/detail')
27 files changed, 384 insertions, 320 deletions
diff --git a/boost/intrusive/detail/any_node_and_algorithms.hpp b/boost/intrusive/detail/any_node_and_algorithms.hpp index 3c76e58528..4b087b582b 100644 --- a/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -21,6 +21,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> #include <cstddef> #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::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; } - 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; } - 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; } - 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; } }; @@ -68,10 +69,10 @@ struct any_slist_node_traits typedef typename node::node_ptr 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; } - 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; } }; @@ -88,22 +89,22 @@ struct any_unordered_node_traits static const bool store_hash = 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; } - 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; } - 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; } - 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; } - 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; } - 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; } }; @@ -117,34 +118,34 @@ struct any_rbtree_node_traits 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - static color black() + BOOST_INTRUSIVE_FORCEINLINE static color black() { return 0u; } - static color red() + BOOST_INTRUSIVE_FORCEINLINE static color red() { return 1u; } }; @@ -158,37 +159,37 @@ struct any_avltree_node_traits 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - 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; } - static balance negative() + BOOST_INTRUSIVE_FORCEINLINE static balance negative() { return 0u; } - static balance zero() + BOOST_INTRUSIVE_FORCEINLINE static balance zero() { return 1u; } - static balance positive() + BOOST_INTRUSIVE_FORCEINLINE static balance positive() { return 2u; } }; @@ -200,22 +201,22 @@ struct any_tree_node_traits typedef typename node::node_ptr 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; } - 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; } - 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; } - 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; } - 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; } - 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; } }; @@ -250,19 +251,19 @@ class any_algorithms //! <b>Throws</b>: Nothing. //! //! <b>Nodes</b>: If node is inserted in a tree, this function corrupts the tree. - static void init(const node_ptr & node) - { node->node_ptr_1 = 0; }; + BOOST_INTRUSIVE_FORCEINLINE static void init(const node_ptr & node) + { node->node_ptr_1 = node_ptr(); }; //! <b>Effects</b>: Returns true if node is in the same state as if called init(node) //! //! <b>Complexity</b>: Constant. //! //! <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; }; - static bool unique(const const_node_ptr & node) - { return 0 == node->node_ptr_1; } + BOOST_INTRUSIVE_FORCEINLINE static bool unique(const const_node_ptr & node) + { return !node->node_ptr_1; } static void unlink(const node_ptr &) { diff --git a/boost/intrusive/detail/avltree_node.hpp b/boost/intrusive/detail/avltree_node.hpp index 22b8fd1219..16d1c1d291 100644 --- a/boost/intrusive/detail/avltree_node.hpp +++ b/boost/intrusive/detail/avltree_node.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/avltree_algorithms.hpp> #include <boost/intrusive/pointer_plus_bits.hpp> @@ -68,49 +69,49 @@ struct default_avltree_node_traits_impl 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_; } - static node_ptr get_parent(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_left(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_right(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { 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; } - static balance get_balance(const const_node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n) { 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_; } - 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; } - static balance negative() + BOOST_INTRUSIVE_FORCEINLINE static balance negative() { return node::negative_t; } - static balance zero() + BOOST_INTRUSIVE_FORCEINLINE static balance zero() { return node::zero_t; } - static balance positive() + BOOST_INTRUSIVE_FORCEINLINE static balance positive() { return node::positive_t; } }; @@ -126,37 +127,37 @@ struct compact_avltree_node_traits_impl 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_); } - 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); } - 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_; } - 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; } - 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_; } - 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; } - 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_); } - 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); } - static balance negative() + BOOST_INTRUSIVE_FORCEINLINE static balance negative() { return node::negative_t; } - static balance zero() + BOOST_INTRUSIVE_FORCEINLINE static balance zero() { return node::zero_t; } - static balance positive() + BOOST_INTRUSIVE_FORCEINLINE static balance positive() { return node::positive_t; } }; diff --git a/boost/intrusive/detail/bstree_algorithms_base.hpp b/boost/intrusive/detail/bstree_algorithms_base.hpp index ed28a430ea..8404010565 100644 --- a/boost/intrusive/detail/bstree_algorithms_base.hpp +++ b/boost/intrusive/detail/bstree_algorithms_base.hpp @@ -69,8 +69,8 @@ class bstree_algorithms_base static node_ptr prev_node(const node_ptr & node) { if(is_header(node)){ - return NodeTraits::get_right(node); - //return maximum(NodeTraits::get_parent(node)); + //return NodeTraits::get_right(node); + return maximum(NodeTraits::get_parent(node)); } else if(NodeTraits::get_left(node)){ return maximum(NodeTraits::get_left(node)); diff --git a/boost/intrusive/detail/config_begin.hpp b/boost/intrusive/detail/config_begin.hpp index 36d605d072..cef8616812 100644 --- a/boost/intrusive/detail/config_begin.hpp +++ b/boost/intrusive/detail/config_begin.hpp @@ -38,13 +38,18 @@ #pragma warning (disable : 4284) // odd return type for operator-> #pragma warning (disable : 4244) // possible loss of data #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 : 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 : 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 //#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE diff --git a/boost/intrusive/detail/default_header_holder.hpp b/boost/intrusive/detail/default_header_holder.hpp index 5f9cd9a444..288f8a0e41 100644 --- a/boost/intrusive/detail/default_header_holder.hpp +++ b/boost/intrusive/detail/default_header_holder.hpp @@ -21,6 +21,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/detail/to_raw_pointer.hpp> @@ -39,14 +40,14 @@ struct default_header_holder : public NodeTraits::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)); } - node_ptr get_node() + BOOST_INTRUSIVE_FORCEINLINE node_ptr get_node() { return pointer_traits< node_ptr >::pointer_to(*static_cast< node* >(this)); } // (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)); } }; diff --git a/boost/intrusive/detail/ebo_functor_holder.hpp b/boost/intrusive/detail/ebo_functor_holder.hpp index 9fec5a32b7..ef278ed805 100644 --- a/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/boost/intrusive/detail/ebo_functor_holder.hpp @@ -22,6 +22,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/move/utility_core.hpp> namespace boost { @@ -165,57 +166,57 @@ class ebo_functor_holder public: typedef T functor_type; - ebo_functor_holder() + BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder() : t_() {} - explicit ebo_functor_holder(const T &t) + BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const 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)) {} 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)) {} - ebo_functor_holder(const ebo_functor_holder &x) - : t_(x) + BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder(const ebo_functor_holder &x) + : t_(x.t_) {} - 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_) {} - 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(); 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()); return *this; } - ebo_functor_holder& operator=(const T &x) + BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x) { this->get() = x; 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); return *this; } - T& get(){return t_;} - const T& get()const{return t_;} + BOOST_INTRUSIVE_FORCEINLINE T& get(){return t_;} + BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return t_;} private: T t_; @@ -230,58 +231,58 @@ class ebo_functor_holder<T, false> public: typedef T functor_type; - ebo_functor_holder() + BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder() : T() {} - explicit ebo_functor_holder(const T &t) + BOOST_INTRUSIVE_FORCEINLINE explicit ebo_functor_holder(const 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)) {} 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)) {} - 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)) {} - 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)) {} - 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; this->get() = x.get(); 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()); return *this; } - ebo_functor_holder& operator=(const T &x) + BOOST_INTRUSIVE_FORCEINLINE ebo_functor_holder& operator=(const T &x) { this->get() = x; 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); return *this; } - T& get(){return *this;} - const T& get()const{return *this;} + BOOST_INTRUSIVE_FORCEINLINE T& get(){return *this;} + BOOST_INTRUSIVE_FORCEINLINE const T& get()const{return *this;} }; } //namespace detail { diff --git a/boost/intrusive/detail/equal_to_value.hpp b/boost/intrusive/detail/equal_to_value.hpp index c341f488e9..c5d9e5305c 100644 --- a/boost/intrusive/detail/equal_to_value.hpp +++ b/boost/intrusive/detail/equal_to_value.hpp @@ -21,6 +21,8 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> + namespace boost { namespace intrusive { namespace detail { @@ -37,7 +39,7 @@ class equal_to_value : t_(t) {} - bool operator()(ConstReference t)const + BOOST_INTRUSIVE_FORCEINLINE bool operator()(ConstReference t)const { return t_ == t; } }; diff --git a/boost/intrusive/detail/exception_disposer.hpp b/boost/intrusive/detail/exception_disposer.hpp index a10d63a75d..91c5bf3b67 100644 --- a/boost/intrusive/detail/exception_disposer.hpp +++ b/boost/intrusive/detail/exception_disposer.hpp @@ -21,6 +21,8 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> + namespace boost { namespace intrusive { namespace detail { @@ -39,7 +41,7 @@ class exception_disposer : cont_(&cont), disp_(disp) {} - void release() + BOOST_INTRUSIVE_FORCEINLINE void release() { cont_ = 0; } ~exception_disposer() @@ -67,7 +69,7 @@ class exception_array_disposer : cont_(&cont), disp_(disp), constructed_(constructed) {} - void release() + BOOST_INTRUSIVE_FORCEINLINE void release() { cont_ = 0; } ~exception_array_disposer() diff --git a/boost/intrusive/detail/has_member_function_callable_with.hpp b/boost/intrusive/detail/has_member_function_callable_with.hpp index c9a8e7e637..2e73305d17 100644 --- a/boost/intrusive/detail/has_member_function_callable_with.hpp +++ b/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -164,13 +164,14 @@ BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG { 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 : 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 - Base(); + Base(){} }; template <typename T, T t> class Helper{}; diff --git a/boost/intrusive/detail/hashtable_node.hpp b/boost/intrusive/detail/hashtable_node.hpp index 352be28cbe..0471ebe684 100644 --- a/boost/intrusive/detail/hashtable_node.hpp +++ b/boost/intrusive/detail/hashtable_node.hpp @@ -21,6 +21,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/assert.hpp> #include <boost/intrusive/pointer_traits.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; } - const bucket_ptr &bucket_begin() const + BOOST_INTRUSIVE_FORCEINLINE const bucket_ptr &bucket_begin() const { return buckets_; } - size_type bucket_count() const + BOOST_INTRUSIVE_FORCEINLINE size_type bucket_count() const { return buckets_len_; } private: @@ -160,11 +161,11 @@ class hashtable_iterator typedef iiterator< value_traits, IsConst , std::forward_iterator_tag> types_t; public: - typedef typename types_t::iterator_traits::difference_type difference_type; - typedef typename types_t::iterator_traits::value_type value_type; - typedef typename types_t::iterator_traits::pointer pointer; - typedef typename types_t::iterator_traits::reference reference; - typedef typename types_t::iterator_traits::iterator_category iterator_category; + typedef typename types_t::iterator_type::difference_type difference_type; + typedef typename types_t::iterator_type::value_type value_type; + typedef typename types_t::iterator_type::pointer pointer; + typedef typename types_t::iterator_type::reference reference; + typedef typename types_t::iterator_type::iterator_category iterator_category; private: typedef typename value_traits::node_traits node_traits; @@ -189,7 +190,7 @@ class hashtable_iterator public: - hashtable_iterator () + BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator () : 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()) {} - const siterator &slist_it() const + BOOST_INTRUSIVE_FORCEINLINE const siterator &slist_it() const { return slist_it_; } hashtable_iterator<BucketValueTraits, false> unconst() const @@ -218,28 +219,28 @@ class hashtable_iterator 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_; } - 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); } - reference operator*() const + BOOST_INTRUSIVE_FORCEINLINE reference operator*() const { return *this->operator ->(); } - pointer operator->() const + BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const { return this->priv_value_traits().to_value_ptr (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_; } - const value_traits &priv_value_traits() const + BOOST_INTRUSIVE_FORCEINLINE const value_traits &priv_value_traits() const { 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(); } private: diff --git a/boost/intrusive/detail/hook_traits.hpp b/boost/intrusive/detail/hook_traits.hpp index 71f342af06..2a16061a54 100644 --- a/boost/intrusive/detail/hook_traits.hpp +++ b/boost/intrusive/detail/hook_traits.hpp @@ -21,6 +21,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/detail/parent_from_member.hpp> #include <boost/intrusive/link_mode.hpp> @@ -54,25 +55,25 @@ struct bhtraits_base typedef node& 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 (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 (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 (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 (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 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 (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 (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 (*detail::parent_from_member<T, Hook> (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 (*detail::parent_from_member<T, Hook> diff --git a/boost/intrusive/detail/iiterator.hpp b/boost/intrusive/detail/iiterator.hpp index 5c6721bd0e..5ab1de2bb1 100644 --- a/boost/intrusive/detail/iiterator.hpp +++ b/boost/intrusive/detail/iiterator.hpp @@ -21,6 +21,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/iterator.hpp> #include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/detail/mpl.hpp> @@ -70,7 +71,7 @@ struct iiterator , difference_type , pointer , reference - > iterator_traits; + > iterator_type; typedef typename value_traits_pointers <ValueTraits>::value_traits_ptr value_traits_ptr; typedef typename value_traits_pointers @@ -83,15 +84,15 @@ template<class NodePtr, class StoredPointer, bool StatefulValueTraits = true> struct iiterator_members { - iiterator_members() + BOOST_INTRUSIVE_FORCEINLINE iiterator_members() : 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) {} - StoredPointer get_ptr() const + BOOST_INTRUSIVE_FORCEINLINE StoredPointer get_ptr() const { return ptr_; } NodePtr nodeptr_; @@ -101,15 +102,15 @@ struct iiterator_members template<class NodePtr, class StoredPointer> struct iiterator_members<NodePtr, StoredPointer, false> { - iiterator_members() + BOOST_INTRUSIVE_FORCEINLINE iiterator_members() : 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) {} - StoredPointer get_ptr() const + BOOST_INTRUSIVE_FORCEINLINE StoredPointer get_ptr() const { return StoredPointer(); } NodePtr nodeptr_; diff --git a/boost/intrusive/detail/iterator.hpp b/boost/intrusive/detail/iterator.hpp index 9f0fe606f4..2ae6abb7d0 100644 --- a/boost/intrusive/detail/iterator.hpp +++ b/boost/intrusive/detail/iterator.hpp @@ -23,6 +23,7 @@ #include <cstddef> #include <boost/intrusive/detail/std_fwd.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/move/detail/iterator_traits.hpp> #include <boost/move/detail/meta_utils_core.hpp> @@ -34,14 +35,14 @@ using boost::movelib::iterator_traits; //////////////////// // 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 { - typedef Category iterator_category; - typedef T value_type; - typedef Distance difference_type; - typedef Pointer pointer; - typedef Reference reference; + typedef Category iterator_category; + typedef T value_type; + typedef Difference difference_type; + typedef Pointer pointer; + typedef Reference reference; }; //////////////////////////////////////// @@ -83,7 +84,7 @@ struct iterator_disable_if_tag_difference_type //////////////////// // advance //////////////////// -template<class InputIt, class Distance> inline +template<class InputIt, class Distance> typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { @@ -91,7 +92,7 @@ typename iterator_enable_if_tag<InputIt, std::input_iterator_tag>::type ++it; } -template<class InputIt, class Distance> inline +template<class InputIt, class Distance> typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { @@ -99,7 +100,7 @@ typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type ++it; } -template<class InputIt, class Distance> inline +template<class InputIt, class Distance> typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { @@ -109,8 +110,8 @@ typename iterator_enable_if_tag<InputIt, std::bidirectional_iterator_tag>::type --it; } -template<class InputIt, class Distance> inline -typename iterator_enable_if_tag<InputIt, std::random_access_iterator_tag>::type +template<class InputIt, class Distance> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::random_access_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { it += n; @@ -132,8 +133,8 @@ typename iterator_disable_if_tag_difference_type return off; } -template<class InputIt> inline -typename iterator_enable_if_tag_difference_type +template<class InputIt> +BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag_difference_type <InputIt, std::random_access_iterator_tag>::type iterator_distance(InputIt first, InputIt last) { @@ -142,11 +143,11 @@ typename iterator_enable_if_tag_difference_type } 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->(); } template<class T> -T * iterator_arrow_result(T *p) +BOOST_INTRUSIVE_FORCEINLINE T * iterator_arrow_result(T *p) { return p; } } //namespace intrusive diff --git a/boost/intrusive/detail/list_iterator.hpp b/boost/intrusive/detail/list_iterator.hpp index 6af4841c3e..6c5f161675 100644 --- a/boost/intrusive/detail/list_iterator.hpp +++ b/boost/intrusive/detail/list_iterator.hpp @@ -22,6 +22,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/iiterator.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; public: - typedef typename types_t::iterator_traits::difference_type difference_type; - typedef typename types_t::iterator_traits::value_type value_type; - typedef typename types_t::iterator_traits::pointer pointer; - typedef typename types_t::iterator_traits::reference reference; - typedef typename types_t::iterator_traits::iterator_category iterator_category; + typedef typename types_t::iterator_type::difference_type difference_type; + typedef typename types_t::iterator_type::value_type value_type; + typedef typename types_t::iterator_type::pointer pointer; + typedef typename types_t::iterator_type::reference reference; + 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) {} - 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()) {} - const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const { 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); } - const_value_traits_ptr get_value_traits() const + BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const { return members_.get_ptr(); } public: - list_iterator& operator++() + BOOST_INTRUSIVE_FORCEINLINE list_iterator& operator++() { node_ptr p = node_traits::get_next(members_.nodeptr_); members_.nodeptr_ = p; return static_cast<list_iterator&> (*this); } - list_iterator operator++(int) + BOOST_INTRUSIVE_FORCEINLINE list_iterator operator++(int) { list_iterator result (*this); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); return result; } - list_iterator& operator--() + BOOST_INTRUSIVE_FORCEINLINE list_iterator& operator--() { members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); return static_cast<list_iterator&> (*this); } - list_iterator operator--(int) + BOOST_INTRUSIVE_FORCEINLINE list_iterator operator--(int) { list_iterator result (*this); members_.nodeptr_ = node_traits::get_previous(members_.nodeptr_); 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(); } - 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); } - reference operator*() const + BOOST_INTRUSIVE_FORCEINLINE reference operator*() const { return *operator->(); } - pointer operator->() const + BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const { return this->operator_arrow(detail::bool_<stateful_value_traits>()); } list_iterator<ValueTraits, false> unconst() const { return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); } private: - pointer operator_arrow(detail::false_) const + BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const { 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_); } iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; diff --git a/boost/intrusive/detail/list_node.hpp b/boost/intrusive/detail/list_node.hpp index f740e545e8..c3b4847011 100644 --- a/boost/intrusive/detail/list_node.hpp +++ b/boost/intrusive/detail/list_node.hpp @@ -22,6 +22,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> namespace boost { @@ -46,22 +47,22 @@ struct list_node_traits typedef typename node::node_ptr 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_; } - static node_ptr get_previous(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_next(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n) { 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; } }; diff --git a/boost/intrusive/detail/parent_from_member.hpp b/boost/intrusive/detail/parent_from_member.hpp index 8701c3f269..275229ab47 100644 --- a/boost/intrusive/detail/parent_from_member.hpp +++ b/boost/intrusive/detail/parent_from_member.hpp @@ -21,9 +21,10 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <cstddef> -#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL)) +#if defined(_MSC_VER) #define BOOST_INTRUSIVE_MSVC_ABI_PTR_TO_MEMBER #include <boost/static_assert.hpp> #endif @@ -33,7 +34,7 @@ namespace intrusive { namespace detail { 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. #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> -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*> ( @@ -100,7 +101,7 @@ inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_ } 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*> ( diff --git a/boost/intrusive/detail/rbtree_node.hpp b/boost/intrusive/detail/rbtree_node.hpp index c4364399d8..68f4bdf8e2 100644 --- a/boost/intrusive/detail/rbtree_node.hpp +++ b/boost/intrusive/detail/rbtree_node.hpp @@ -23,6 +23,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> #include <boost/intrusive/rbtree_algorithms.hpp> #include <boost/intrusive/pointer_plus_bits.hpp> @@ -73,46 +74,46 @@ struct default_rbtree_node_traits_impl 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_; } - static node_ptr get_parent(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_left(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_right(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { 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; } - static color get_color(const const_node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n) { 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_; } - 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; } - static color black() + BOOST_INTRUSIVE_FORCEINLINE static color black() { return node::black_t; } - static color red() + BOOST_INTRUSIVE_FORCEINLINE static color red() { return node::red_t; } }; @@ -129,46 +130,46 @@ struct compact_rbtree_node_traits_impl 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_); } - 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_); } - 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); } - 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_; } - static node_ptr get_left(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_right(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { 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; } - 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_); } - 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_); } - 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); } - static color black() + BOOST_INTRUSIVE_FORCEINLINE static color black() { return node::black_t; } - static color red() + BOOST_INTRUSIVE_FORCEINLINE static color red() { return node::red_t; } }; diff --git a/boost/intrusive/detail/reverse_iterator.hpp b/boost/intrusive/detail/reverse_iterator.hpp index 552e8f4d71..57631feb5d 100644 --- a/boost/intrusive/detail/reverse_iterator.hpp +++ b/boost/intrusive/detail/reverse_iterator.hpp @@ -43,12 +43,16 @@ class reverse_iterator reverse_iterator() : m_current() //Value initialization to achieve "null iterators" (N3644) - {} + {} explicit reverse_iterator(It r) : m_current(r) {} + reverse_iterator(const reverse_iterator& r) + : m_current(r.base()) + {} + template<class OtherIt> reverse_iterator( const reverse_iterator<OtherIt>& r , typename boost::intrusive::detail::enable_if_convertible<OtherIt, It>::type* =0 @@ -56,6 +60,9 @@ class reverse_iterator : m_current(r.base()) {} + reverse_iterator & operator=( const reverse_iterator& r) + { m_current = r.base(); return *this; } + template<class OtherIt> typename boost::intrusive::detail::enable_if_convertible<OtherIt, It, reverse_iterator &>::type operator=( const reverse_iterator<OtherIt>& r) @@ -65,20 +72,34 @@ class reverse_iterator { return m_current; } reference operator*() const - { It temp(m_current); --temp; return *temp; } + { + It temp(m_current); + --temp; + reference r = *temp; + return r; + } 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 - { return this->m_current[-off - 1]; } + { + return this->m_current[-off - 1]; + } reverse_iterator& operator++() - { --m_current; return *this; } + { + --m_current; + return *this; + } reverse_iterator operator++(int) { - reverse_iterator temp = *this; + reverse_iterator temp((*this)); --m_current; return temp; } @@ -91,7 +112,7 @@ class reverse_iterator reverse_iterator operator--(int) { - reverse_iterator temp(*this); + reverse_iterator temp((*this)); ++m_current; return temp; } @@ -117,17 +138,17 @@ class reverse_iterator reverse_iterator& operator+=(difference_type off) { 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) - { l.m_current -= off; return l; } + { return (l += off); } friend reverse_iterator operator+(difference_type off, reverse_iterator r) { return (r += off); } - reverse_iterator& operator-=(difference_type off) - { m_current += off; return *this; } - 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) { return r.m_current - l.m_current; } diff --git a/boost/intrusive/detail/size_holder.hpp b/boost/intrusive/detail/size_holder.hpp index de1933ed50..9802ac32f1 100644 --- a/boost/intrusive/detail/size_holder.hpp +++ b/boost/intrusive/detail/size_holder.hpp @@ -21,6 +21,8 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> + namespace boost { namespace intrusive { namespace detail { @@ -31,22 +33,22 @@ struct size_holder static const bool constant_time_size = ConstantSize; typedef SizeType size_type; - SizeType get_size() const + BOOST_INTRUSIVE_FORCEINLINE SizeType get_size() const { return size_; } - void set_size(SizeType size) + BOOST_INTRUSIVE_FORCEINLINE void set_size(SizeType size) { size_ = size; } - void decrement() + BOOST_INTRUSIVE_FORCEINLINE void decrement() { --size_; } - void increment() + BOOST_INTRUSIVE_FORCEINLINE void increment() { ++size_; } - void increase(SizeType n) + BOOST_INTRUSIVE_FORCEINLINE void increase(SizeType n) { size_ += n; } - void decrease(SizeType n) + BOOST_INTRUSIVE_FORCEINLINE void decrease(SizeType n) { size_ -= n; } SizeType size_; @@ -58,22 +60,22 @@ struct size_holder<false, SizeType, Tag> static const bool constant_time_size = false; typedef SizeType size_type; - size_type get_size() const + BOOST_INTRUSIVE_FORCEINLINE size_type get_size() const { 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) {} }; diff --git a/boost/intrusive/detail/slist_iterator.hpp b/boost/intrusive/detail/slist_iterator.hpp index 1699064ec1..63ce5c3fef 100644 --- a/boost/intrusive/detail/slist_iterator.hpp +++ b/boost/intrusive/detail/slist_iterator.hpp @@ -23,6 +23,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/iiterator.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; public: - typedef typename types_t::iterator_traits::difference_type difference_type; - typedef typename types_t::iterator_traits::value_type value_type; - typedef typename types_t::iterator_traits::pointer pointer; - typedef typename types_t::iterator_traits::reference reference; - typedef typename types_t::iterator_traits::iterator_category iterator_category; + typedef typename types_t::iterator_type::difference_type difference_type; + typedef typename types_t::iterator_type::value_type value_type; + typedef typename types_t::iterator_type::pointer pointer; + typedef typename types_t::iterator_type::reference reference; + 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) {} - 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()) {} - const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const { 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); } - const_value_traits_ptr get_value_traits() const + BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const { return members_.get_ptr(); } public: - slist_iterator& operator++() + BOOST_INTRUSIVE_FORCEINLINE slist_iterator& operator++() { members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); return static_cast<slist_iterator&> (*this); } - slist_iterator operator++(int) + BOOST_INTRUSIVE_FORCEINLINE slist_iterator operator++(int) { slist_iterator result (*this); members_.nodeptr_ = node_traits::get_next(members_.nodeptr_); 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(); } - 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); } - reference operator*() const + BOOST_INTRUSIVE_FORCEINLINE reference operator*() const { return *operator->(); } - pointer operator->() const + BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const { 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()); } private: - pointer operator_arrow(detail::false_) const + BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const { 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_); } iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; diff --git a/boost/intrusive/detail/slist_node.hpp b/boost/intrusive/detail/slist_node.hpp index 3d5fbfb6e5..848764e571 100644 --- a/boost/intrusive/detail/slist_node.hpp +++ b/boost/intrusive/detail/slist_node.hpp @@ -23,6 +23,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> namespace boost { @@ -45,13 +46,13 @@ struct slist_node_traits typedef typename node::node_ptr 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_; } - static node_ptr get_next(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n) { 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; } }; diff --git a/boost/intrusive/detail/to_raw_pointer.hpp b/boost/intrusive/detail/to_raw_pointer.hpp index 387f63f2a4..8ea884959d 100644 --- a/boost/intrusive/detail/to_raw_pointer.hpp +++ b/boost/intrusive/detail/to_raw_pointer.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/pointer_element.hpp> namespace boost { @@ -29,11 +30,11 @@ namespace intrusive { namespace detail { template <class T> -inline T* to_raw_pointer(T* p) +BOOST_INTRUSIVE_FORCEINLINE T* to_raw_pointer(T* p) { return p; } 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) { return boost::intrusive::detail::to_raw_pointer(p.operator->()); } diff --git a/boost/intrusive/detail/transform_iterator.hpp b/boost/intrusive/detail/transform_iterator.hpp index 5e3b1a7652..0a715754d7 100644 --- a/boost/intrusive/detail/transform_iterator.hpp +++ b/boost/intrusive/detail/transform_iterator.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/mpl.hpp> #include <boost/intrusive/detail/iterator.hpp> @@ -32,11 +33,11 @@ namespace detail { template <class PseudoReference> struct operator_arrow_proxy { - operator_arrow_proxy(const PseudoReference &px) + BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy(const PseudoReference &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-> // again automatically per 13.3.1.2 para 8 // operator T*() const { return &m_value; } @@ -46,11 +47,11 @@ struct operator_arrow_proxy template <class T> struct operator_arrow_proxy<T&> { - operator_arrow_proxy(T &px) + BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy(T &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-> // again automatically per 13.3.1.2 para 8 // operator T*() const { return &m_value; } @@ -75,53 +76,53 @@ class transform_iterator : members_() {} - Iterator get_it() const + BOOST_INTRUSIVE_FORCEINLINE Iterator get_it() const { return members_.m_it; } //Constructors - transform_iterator& operator++() + BOOST_INTRUSIVE_FORCEINLINE transform_iterator& operator++() { increment(); return *this; } - transform_iterator operator++(int) + BOOST_INTRUSIVE_FORCEINLINE transform_iterator operator++(int) { transform_iterator result (*this); increment(); 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); } - 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); } - 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); } //Arithmetic transform_iterator& operator+=(typename Iterator::difference_type off) { 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); other.advance(off); 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; } - transform_iterator& operator-=(typename Iterator::difference_type off) + BOOST_INTRUSIVE_FORCEINLINE transform_iterator& operator-=(typename Iterator::difference_type off) { 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); } - typename UnaryFunction::result_type operator*() const + BOOST_INTRUSIVE_FORCEINLINE typename UnaryFunction::result_type operator*() const { return dereference(); } - operator_arrow_proxy<typename UnaryFunction::result_type> + BOOST_INTRUSIVE_FORCEINLINE operator_arrow_proxy<typename UnaryFunction::result_type> operator->() const { return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); } @@ -129,27 +130,27 @@ class transform_iterator struct members : UnaryFunction { - members(const Iterator &it, const UnaryFunction &f) + BOOST_INTRUSIVE_FORCEINLINE members(const Iterator &it, const UnaryFunction &f) : UnaryFunction(f), m_it(it) {} - members() + BOOST_INTRUSIVE_FORCEINLINE members() {} Iterator m_it; } members_; - void increment() + BOOST_INTRUSIVE_FORCEINLINE void increment() { ++members_.m_it; } - void decrement() + BOOST_INTRUSIVE_FORCEINLINE void decrement() { --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; } - 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; } typename UnaryFunction::result_type dereference() const diff --git a/boost/intrusive/detail/tree_iterator.hpp b/boost/intrusive/detail/tree_iterator.hpp index 4985c6ce7b..f36a1f244b 100644 --- a/boost/intrusive/detail/tree_iterator.hpp +++ b/boost/intrusive/detail/tree_iterator.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/std_fwd.hpp> #include <boost/intrusive/detail/iiterator.hpp> #include <boost/intrusive/detail/bstree_algorithms_base.hpp> @@ -56,27 +57,27 @@ class tree_iterator typedef void (tree_iterator::*unspecified_bool_type)() const; public: - typedef typename types_t::iterator_traits::difference_type difference_type; - typedef typename types_t::iterator_traits::value_type value_type; - typedef typename types_t::iterator_traits::pointer pointer; - typedef typename types_t::iterator_traits::reference reference; - typedef typename types_t::iterator_traits::iterator_category iterator_category; + typedef typename types_t::iterator_type::difference_type difference_type; + typedef typename types_t::iterator_type::value_type value_type; + typedef typename types_t::iterator_type::pointer pointer; + typedef typename types_t::iterator_type::reference reference; + 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) {} - 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()) {} - const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const { 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); } public: @@ -106,43 +107,43 @@ class tree_iterator return result; } - tree_iterator& go_left() + BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_left() { members_.nodeptr_ = node_traits::get_left(members_.nodeptr_); 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_); 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_); 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; } - bool operator! () const + BOOST_INTRUSIVE_FORCEINLINE bool operator! () const { 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(); } - 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); } - reference operator*() const + BOOST_INTRUSIVE_FORCEINLINE reference operator*() const { return *operator->(); } - pointer operator->() const + BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const { 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(); } 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()); } private: - pointer operator_arrow(detail::false_) const + BOOST_INTRUSIVE_FORCEINLINE pointer operator_arrow(detail::false_) const { 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_); } iiterator_members<node_ptr, const_value_traits_ptr, stateful_value_traits> members_; diff --git a/boost/intrusive/detail/tree_node.hpp b/boost/intrusive/detail/tree_node.hpp index e36a82a6d6..606fbc865e 100644 --- a/boost/intrusive/detail/tree_node.hpp +++ b/boost/intrusive/detail/tree_node.hpp @@ -22,6 +22,7 @@ #endif #include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/pointer_rebind.hpp> namespace boost { @@ -43,31 +44,31 @@ struct tree_node_traits typedef typename node::node_ptr 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_; } - static node_ptr get_parent(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_left(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { 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; } - 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_; } - static node_ptr get_right(const node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { 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; } }; diff --git a/boost/intrusive/detail/tree_value_compare.hpp b/boost/intrusive/detail/tree_value_compare.hpp index dc554442fe..810d894066 100644 --- a/boost/intrusive/detail/tree_value_compare.hpp +++ b/boost/intrusive/detail/tree_value_compare.hpp @@ -18,6 +18,7 @@ # pragma once #endif +#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/mpl.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) { 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); } - key_compare &key_comp() + BOOST_INTRUSIVE_FORCEINLINE key_compare &key_comp() { return static_cast<key_compare &>(*this); } template<class U> @@ -70,16 +71,16 @@ struct tree_value_compare { return key; } 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 { return KeyOfValue()(key); } 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)); } 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)); } }; diff --git a/boost/intrusive/detail/workaround.hpp b/boost/intrusive/detail/workaround.hpp index b73f4ef8bf..7a9ac48e0b 100644 --- a/boost/intrusive/detail/workaround.hpp +++ b/boost/intrusive/detail/workaround.hpp @@ -34,5 +34,17 @@ #define BOOST_INTRUSIVE_I , #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 |