diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:22:41 +0900 |
commit | 3c1df2168531ad5580076ae08d529054689aeedd (patch) | |
tree | 941aff6f86393eecacddfec252a8508c7e8351c9 /boost/intrusive | |
parent | d6a306e745acfee00e81ccaf3324a2a03516db41 (diff) | |
download | boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.gz boost-3c1df2168531ad5580076ae08d529054689aeedd.tar.bz2 boost-3c1df2168531ad5580076ae08d529054689aeedd.zip |
Imported Upstream version 1.70.0upstream/1.70.0
Diffstat (limited to 'boost/intrusive')
35 files changed, 520 insertions, 422 deletions
diff --git a/boost/intrusive/avl_set.hpp b/boost/intrusive/avl_set.hpp index d150140abd..d714ab12f0 100644 --- a/boost/intrusive/avl_set.hpp +++ b/boost/intrusive/avl_set.hpp @@ -525,46 +525,46 @@ class avl_set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - avl_set() + BOOST_INTRUSIVE_FORCEINLINE avl_set() : Base() {} - explicit avl_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit avl_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - avl_set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE avl_set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - avl_set(BOOST_RV_REF(avl_set) x) + BOOST_INTRUSIVE_FORCEINLINE avl_set(BOOST_RV_REF(avl_set) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - avl_set& operator=(BOOST_RV_REF(avl_set) x) + BOOST_INTRUSIVE_FORCEINLINE avl_set& operator=(BOOST_RV_REF(avl_set) x) { return static_cast<avl_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const avl_set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const avl_set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(avl_set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(avl_set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static avl_set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static avl_set &container_from_end_iterator(iterator end_iterator) { return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); } - static const avl_set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const avl_set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const avl_set &>(Base::container_from_end_iterator(end_iterator)); } - static avl_set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static avl_set &container_from_iterator(iterator it) { return static_cast<avl_set &>(Base::container_from_iterator(it)); } - static const avl_set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const avl_set &container_from_iterator(const_iterator it) { return static_cast<const avl_set &>(Base::container_from_iterator(it)); } }; @@ -1020,46 +1020,46 @@ class avl_multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - avl_multiset() + BOOST_INTRUSIVE_FORCEINLINE avl_multiset() : Base() {} - explicit avl_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit avl_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - avl_multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE avl_multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - avl_multiset(BOOST_RV_REF(avl_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE avl_multiset(BOOST_RV_REF(avl_multiset) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x) { return static_cast<avl_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const avl_multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const avl_multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(avl_multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(avl_multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static avl_multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static avl_multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const avl_multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const avl_multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const avl_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static avl_multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static avl_multiset &container_from_iterator(iterator it) { return static_cast<avl_multiset &>(Base::container_from_iterator(it)); } - static const avl_multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const avl_multiset &container_from_iterator(const_iterator it) { return static_cast<const avl_multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/avltree.hpp b/boost/intrusive/avltree.hpp index cdc9b75d60..b80cb938e1 100644 --- a/boost/intrusive/avltree.hpp +++ b/boost/intrusive/avltree.hpp @@ -535,46 +535,46 @@ class avltree //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - avltree() + BOOST_INTRUSIVE_FORCEINLINE avltree() : Base() {} - explicit avltree( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit avltree( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - avltree( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE avltree( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, v_traits) {} - avltree(BOOST_RV_REF(avltree) x) + BOOST_INTRUSIVE_FORCEINLINE avltree(BOOST_RV_REF(avltree) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - avltree& operator=(BOOST_RV_REF(avltree) x) + BOOST_INTRUSIVE_FORCEINLINE avltree& operator=(BOOST_RV_REF(avltree) x) { return static_cast<avltree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const avltree &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const avltree &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(avltree) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(avltree) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static avltree &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static avltree &container_from_end_iterator(iterator end_iterator) { return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); } - static const avltree &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const avltree &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const avltree &>(Base::container_from_end_iterator(end_iterator)); } - static avltree &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static avltree &container_from_iterator(iterator it) { return static_cast<avltree &>(Base::container_from_iterator(it)); } - static const avltree &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const avltree &container_from_iterator(const_iterator it) { return static_cast<const avltree &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/bs_set.hpp b/boost/intrusive/bs_set.hpp index 693b6d855c..cbb2a35f8a 100644 --- a/boost/intrusive/bs_set.hpp +++ b/boost/intrusive/bs_set.hpp @@ -522,46 +522,46 @@ class bs_set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - bs_set() + BOOST_INTRUSIVE_FORCEINLINE bs_set() : Base() {} - explicit bs_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit bs_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - bs_set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE bs_set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - bs_set(BOOST_RV_REF(bs_set) x) + BOOST_INTRUSIVE_FORCEINLINE bs_set(BOOST_RV_REF(bs_set) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - bs_set& operator=(BOOST_RV_REF(bs_set) x) + BOOST_INTRUSIVE_FORCEINLINE bs_set& operator=(BOOST_RV_REF(bs_set) x) { return static_cast<bs_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const bs_set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const bs_set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(bs_set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(bs_set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static bs_set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static bs_set &container_from_end_iterator(iterator end_iterator) { return static_cast<bs_set &>(Base::container_from_end_iterator(end_iterator)); } - static const bs_set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const bs_set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const bs_set &>(Base::container_from_end_iterator(end_iterator)); } - static bs_set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static bs_set &container_from_iterator(iterator it) { return static_cast<bs_set &>(Base::container_from_iterator(it)); } - static const bs_set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const bs_set &container_from_iterator(const_iterator it) { return static_cast<const bs_set &>(Base::container_from_iterator(it)); } }; @@ -1016,46 +1016,46 @@ class bs_multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - bs_multiset() + BOOST_INTRUSIVE_FORCEINLINE bs_multiset() : Base() {} - explicit bs_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit bs_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - bs_multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE bs_multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - bs_multiset(BOOST_RV_REF(bs_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE bs_multiset(BOOST_RV_REF(bs_multiset) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - bs_multiset& operator=(BOOST_RV_REF(bs_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE bs_multiset& operator=(BOOST_RV_REF(bs_multiset) x) { return static_cast<bs_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const bs_multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const bs_multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(bs_multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(bs_multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static bs_multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static bs_multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<bs_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const bs_multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const bs_multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const bs_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static bs_multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static bs_multiset &container_from_iterator(iterator it) { return static_cast<bs_multiset &>(Base::container_from_iterator(it)); } - static const bs_multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const bs_multiset &container_from_iterator(const_iterator it) { return static_cast<const bs_multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/bstree.hpp b/boost/intrusive/bstree.hpp index 410eedf930..2cde5314d5 100644 --- a/boost/intrusive/bstree.hpp +++ b/boost/intrusive/bstree.hpp @@ -2194,46 +2194,46 @@ class bstree //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - bstree() + BOOST_INTRUSIVE_FORCEINLINE bstree() : Base() {} - explicit bstree( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit bstree( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - bstree( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE bstree( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, v_traits) {} - bstree(BOOST_RV_REF(bstree) x) + BOOST_INTRUSIVE_FORCEINLINE bstree(BOOST_RV_REF(bstree) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - bstree& operator=(BOOST_RV_REF(bstree) x) + BOOST_INTRUSIVE_FORCEINLINE bstree& operator=(BOOST_RV_REF(bstree) x) { return static_cast<bstree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const bstree &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const bstree &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(bstree) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(bstree) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static bstree &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static bstree &container_from_end_iterator(iterator end_iterator) { return static_cast<bstree &>(Base::container_from_end_iterator(end_iterator)); } - static const bstree &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const bstree &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const bstree &>(Base::container_from_end_iterator(end_iterator)); } - static bstree &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static bstree &container_from_iterator(iterator it) { return static_cast<bstree &>(Base::container_from_iterator(it)); } - static const bstree &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const bstree &container_from_iterator(const_iterator it) { return static_cast<const bstree &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/bstree_algorithms.hpp b/boost/intrusive/bstree_algorithms.hpp index 006d9c238b..9088911d4d 100644 --- a/boost/intrusive/bstree_algorithms.hpp +++ b/boost/intrusive/bstree_algorithms.hpp @@ -564,7 +564,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits> NodeTraits::set_parent(node, node_ptr()); NodeTraits::set_left(node, node_ptr()); NodeTraits::set_right(node, node_ptr()); - }; + } //! <b>Effects</b>: Returns true if node is in the same state as if called init(node) //! @@ -576,7 +576,7 @@ class bstree_algorithms : public bstree_algorithms_base<NodeTraits> return !NodeTraits::get_parent(node) && !NodeTraits::get_left(node) && !NodeTraits::get_right(node) ; - }; + } //! <b>Requires</b>: node must not be part of any tree. //! diff --git a/boost/intrusive/detail/ebo_functor_holder.hpp b/boost/intrusive/detail/ebo_functor_holder.hpp index 27415c1170..8883166783 100644 --- a/boost/intrusive/detail/ebo_functor_holder.hpp +++ b/boost/intrusive/detail/ebo_functor_holder.hpp @@ -158,7 +158,7 @@ template<typename T> struct is_unary_or_binary_function : is_unary_or_binary_function_impl<T> {}; -template<typename T, bool = is_unary_or_binary_function<T>::value> +template<typename T, typename Tag = void, bool = is_unary_or_binary_function<T>::value> class ebo_functor_holder { BOOST_COPYABLE_AND_MOVABLE(ebo_functor_holder) @@ -222,8 +222,8 @@ class ebo_functor_holder T t_; }; -template<typename T> -class ebo_functor_holder<T, false> +template<typename T, typename Tag> +class ebo_functor_holder<T, Tag, false> : public T { BOOST_COPYABLE_AND_MOVABLE(ebo_functor_holder) diff --git a/boost/intrusive/detail/generic_hook.hpp b/boost/intrusive/detail/generic_hook.hpp index 13421b8805..eff7fa0472 100644 --- a/boost/intrusive/detail/generic_hook.hpp +++ b/boost/intrusive/detail/generic_hook.hpp @@ -161,52 +161,52 @@ class generic_hook < NodeTraits , Tag, LinkMode, BaseHookType> hooktags; - node_ptr this_ptr() + BOOST_INTRUSIVE_FORCEINLINE node_ptr this_ptr() { return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*this)); } - const_node_ptr this_ptr() const + BOOST_INTRUSIVE_FORCEINLINE const_node_ptr this_ptr() const { return pointer_traits<const_node_ptr>::pointer_to(static_cast<const node&>(*this)); } public: /// @endcond - generic_hook() + BOOST_INTRUSIVE_FORCEINLINE generic_hook() { if(hooktags::safemode_or_autounlink){ node_algorithms::init(this->this_ptr()); } } - generic_hook(const generic_hook& ) + BOOST_INTRUSIVE_FORCEINLINE generic_hook(const generic_hook& ) { if(hooktags::safemode_or_autounlink){ node_algorithms::init(this->this_ptr()); } } - generic_hook& operator=(const generic_hook& ) + BOOST_INTRUSIVE_FORCEINLINE generic_hook& operator=(const generic_hook& ) { return *this; } - ~generic_hook() + BOOST_INTRUSIVE_FORCEINLINE ~generic_hook() { destructor_impl (*this, detail::link_dispatch<hooktags::link_mode>()); } - void swap_nodes(generic_hook &other) + BOOST_INTRUSIVE_FORCEINLINE void swap_nodes(generic_hook &other) { node_algorithms::swap_nodes (this->this_ptr(), other.this_ptr()); } - bool is_linked() const + BOOST_INTRUSIVE_FORCEINLINE bool is_linked() const { //is_linked() can be only used in safe-mode or auto-unlink BOOST_STATIC_ASSERT(( hooktags::safemode_or_autounlink )); return !node_algorithms::unique(this->this_ptr()); } - void unlink() + BOOST_INTRUSIVE_FORCEINLINE void unlink() { BOOST_STATIC_ASSERT(( (int)hooktags::link_mode == (int)auto_unlink )); node_ptr n(this->this_ptr()); diff --git a/boost/intrusive/detail/hashtable_node.hpp b/boost/intrusive/detail/hashtable_node.hpp index d3b11d1b22..913c38da70 100644 --- a/boost/intrusive/detail/hashtable_node.hpp +++ b/boost/intrusive/detail/hashtable_node.hpp @@ -34,7 +34,6 @@ namespace boost { namespace intrusive { -namespace detail { template <class Slist> struct bucket_impl : public Slist @@ -149,8 +148,6 @@ struct get_slist_impl {}; }; -} //namespace detail { - template<class BucketValueTraits, bool IsConst> class hashtable_iterator { @@ -169,17 +166,22 @@ class hashtable_iterator private: typedef typename value_traits::node_traits node_traits; typedef typename node_traits::node_ptr node_ptr; - typedef typename detail::get_slist_impl - < typename detail::reduced_slist_node_traits + typedef typename get_slist_impl + < typename reduced_slist_node_traits <node_traits>::type >::type slist_impl; typedef typename slist_impl::iterator siterator; typedef typename slist_impl::const_iterator const_siterator; - typedef detail::bucket_impl<slist_impl> bucket_type; + typedef bucket_impl<slist_impl> bucket_type; typedef typename pointer_traits <pointer>::template rebind_pointer < const BucketValueTraits >::type const_bucketvaltraits_ptr; typedef typename slist_impl::size_type size_type; + class nat; + typedef typename + detail::if_c< IsConst + , hashtable_iterator<BucketValueTraits, false> + , nat>::type nonconst_iterator; BOOST_INTRUSIVE_FORCEINLINE static node_ptr downcast_bucket(typename bucket_type::node_ptr p) { @@ -193,12 +195,16 @@ class hashtable_iterator : slist_it_() //Value initialization to achieve "null iterators" (N3644) {} - explicit hashtable_iterator(siterator ptr, const BucketValueTraits *cont) + BOOST_INTRUSIVE_FORCEINLINE explicit hashtable_iterator(siterator ptr, const BucketValueTraits *cont) : slist_it_ (ptr) , traitsptr_ (cont ? pointer_traits<const_bucketvaltraits_ptr>::pointer_to(*cont) : const_bucketvaltraits_ptr() ) {} - BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const hashtable_iterator<BucketValueTraits, false> &other) + BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const hashtable_iterator &other) + : slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits()) + {} + + BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator(const nonconst_iterator &other) : slist_it_(other.slist_it()), traitsptr_(other.get_bucket_value_traits()) {} @@ -211,7 +217,10 @@ class hashtable_iterator BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator& operator++() { this->increment(); return *this; } - hashtable_iterator operator++(int) + BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator &operator=(const hashtable_iterator &other) + { slist_it_ = other.slist_it(); traitsptr_ = other.get_bucket_value_traits(); return *this; } + + BOOST_INTRUSIVE_FORCEINLINE hashtable_iterator operator++(int) { hashtable_iterator result (*this); this->increment(); diff --git a/boost/intrusive/detail/hook_traits.hpp b/boost/intrusive/detail/hook_traits.hpp index 7a6f206ca2..7f7dc27e0e 100644 --- a/boost/intrusive/detail/hook_traits.hpp +++ b/boost/intrusive/detail/hook_traits.hpp @@ -57,26 +57,34 @@ struct bhtraits_base BOOST_INTRUSIVE_FORCEINLINE static pointer to_value_ptr(const node_ptr & n) { - return pointer_traits<pointer>::pointer_to + pointer p = pointer_traits<pointer>::pointer_to (static_cast<reference>(static_cast<node_holder_reference>(*n))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static const_pointer to_value_ptr(const const_node_ptr & n) { - return pointer_traits<const_pointer>::pointer_to + const_pointer p = pointer_traits<const_pointer>::pointer_to (static_cast<const_reference>(static_cast<const_node_holder_reference>(*n))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr to_node_ptr(reference value) { - return pointer_traits<node_ptr>::pointer_to + node_ptr p = pointer_traits<node_ptr>::pointer_to (static_cast<node_reference>(static_cast<node_holder_reference>(value))); + BOOST_ASSERT(!!p); + return p; } BOOST_INTRUSIVE_FORCEINLINE static const_node_ptr to_node_ptr(const_reference value) { - return pointer_traits<const_node_ptr>::pointer_to + const_node_ptr p = pointer_traits<const_node_ptr>::pointer_to (static_cast<const_node_reference>(static_cast<const_node_holder_reference>(value))); + BOOST_ASSERT(!!p); + return p; } }; diff --git a/boost/intrusive/detail/iterator.hpp b/boost/intrusive/detail/iterator.hpp index c25be430a2..41ffca1255 100644 --- a/boost/intrusive/detail/iterator.hpp +++ b/boost/intrusive/detail/iterator.hpp @@ -147,7 +147,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::input_ iterator_advance(InputIt& it, Distance n) { while(n--) - ++it; + ++it; } template<class InputIt, class Distance> @@ -155,7 +155,7 @@ typename iterator_enable_if_tag<InputIt, std::forward_iterator_tag>::type iterator_advance(InputIt& it, Distance n) { while(n--) - ++it; + ++it; } template<class InputIt, class Distance> @@ -163,9 +163,9 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_tag<InputIt, std::bidire iterator_advance(InputIt& it, Distance n) { for (; 0 < n; --n) - ++it; + ++it; for (; n < 0; ++n) - --it; + --it; } template<class InputIt, class Distance> @@ -181,7 +181,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag iterator_advance(InputIt& it, Distance n) { while(n--) - ++it; + ++it; } template<class InputIt, class Distance> @@ -190,7 +190,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag iterator_advance(InputIt& it, Distance n) { while(n--) - ++it; + ++it; } template<class InputIt, class Distance> @@ -199,7 +199,7 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag iterator_advance(InputIt& it, Distance n) { while(n--) - ++it; + ++it; } template<class InputIt, class Distance> @@ -208,9 +208,9 @@ BOOST_INTRUSIVE_FORCEINLINE typename iterator_enable_if_convertible_tag iterator_advance(InputIt& it, Distance n) { for (; 0 < n; --n) - ++it; + ++it; for (; n < 0; ++n) - --it; + --it; } class fake{}; @@ -233,7 +233,7 @@ typename iterator_disable_if_tag_difference_type { typename iterator_traits<InputIt>::difference_type off = 0; while(first != last){ - ++off; + ++off; ++first; } return off; diff --git a/boost/intrusive/detail/key_nodeptr_comp.hpp b/boost/intrusive/detail/key_nodeptr_comp.hpp index bdc025e5ab..1029a3404a 100644 --- a/boost/intrusive/detail/key_nodeptr_comp.hpp +++ b/boost/intrusive/detail/key_nodeptr_comp.hpp @@ -78,7 +78,7 @@ public: static const bool value = same_type || is_convertible<P1, const_node_ptr>::value; }; - base_t base() const + BOOST_INTRUSIVE_FORCEINLINE base_t base() const { return static_cast<const base_t&>(*this); } BOOST_INTRUSIVE_FORCEINLINE key_nodeptr_comp(KeyTypeKeyCompare kcomp, const ValueTraits *traits) diff --git a/boost/intrusive/detail/list_iterator.hpp b/boost/intrusive/detail/list_iterator.hpp index 3aae2d5a54..880b6a9847 100644 --- a/boost/intrusive/detail/list_iterator.hpp +++ b/boost/intrusive/detail/list_iterator.hpp @@ -47,6 +47,11 @@ class list_iterator typedef typename types_t::node node; typedef typename types_t::node_ptr node_ptr; typedef typename types_t::const_value_traits_ptr const_value_traits_ptr; + class nat; + typedef typename + detail::if_c< IsConst + , list_iterator<value_traits, false> + , nat>::type nonconst_iterator; public: typedef typename types_t::iterator_type::difference_type difference_type; @@ -62,15 +67,22 @@ class list_iterator : members_(nodeptr, traits_ptr) {} - BOOST_INTRUSIVE_FORCEINLINE list_iterator(list_iterator<ValueTraits, false> const& other) + BOOST_INTRUSIVE_FORCEINLINE list_iterator(const list_iterator &other) : members_(other.pointed_node(), other.get_value_traits()) {} + BOOST_INTRUSIVE_FORCEINLINE list_iterator(const nonconst_iterator &other) + : members_(other.pointed_node(), other.get_value_traits()) + {} + + BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const list_iterator &other) + { members_.nodeptr_ = other.members_.nodeptr_; return *this; } + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const { return members_.nodeptr_; } BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const node_ptr &node) - { members_.nodeptr_ = node; return static_cast<list_iterator&>(*this); } + { members_.nodeptr_ = node; return *this; } BOOST_INTRUSIVE_FORCEINLINE const_value_traits_ptr get_value_traits() const { return members_.get_ptr(); } @@ -115,7 +127,7 @@ class list_iterator BOOST_INTRUSIVE_FORCEINLINE pointer operator->() const { return this->operator_arrow(detail::bool_<stateful_value_traits>()); } - list_iterator<ValueTraits, false> unconst() const + BOOST_INTRUSIVE_FORCEINLINE list_iterator<ValueTraits, false> unconst() const { return list_iterator<ValueTraits, false>(this->pointed_node(), this->get_value_traits()); } private: diff --git a/boost/intrusive/detail/math.hpp b/boost/intrusive/detail/math.hpp index 4901053cb3..200f8b8776 100644 --- a/boost/intrusive/detail/math.hpp +++ b/boost/intrusive/detail/math.hpp @@ -262,7 +262,7 @@ template<class SizeType, class Enabler = void > struct sqrt2_pow_max; template <class SizeType> -struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 32> >::type> +struct sqrt2_pow_max<SizeType, typename voider<typename enable_if< numbits_eq<SizeType, 32> >::type>::type> { static const SizeType value = 0xb504f334; static const std::size_t pow = 31; @@ -271,7 +271,7 @@ struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 32> >::t #ifndef BOOST_NO_INT64_T template <class SizeType> -struct sqrt2_pow_max<SizeType, typename enable_if< numbits_eq<SizeType, 64> >::type> +struct sqrt2_pow_max<SizeType, typename voider<typename enable_if< numbits_eq<SizeType, 64> >::type>::type> { static const SizeType value = 0xb504f333f9de6484ull; static const std::size_t pow = 63; diff --git a/boost/intrusive/detail/mpl.hpp b/boost/intrusive/detail/mpl.hpp index 1523088161..935c04c282 100644 --- a/boost/intrusive/detail/mpl.hpp +++ b/boost/intrusive/detail/mpl.hpp @@ -40,6 +40,7 @@ using boost::move_detail::remove_pointer; using boost::move_detail::add_pointer; using boost::move_detail::true_type; using boost::move_detail::false_type; +using boost::move_detail::voider; using boost::move_detail::enable_if_c; using boost::move_detail::enable_if; using boost::move_detail::disable_if_c; diff --git a/boost/intrusive/detail/slist_iterator.hpp b/boost/intrusive/detail/slist_iterator.hpp index 96a5ac0191..9e72af9f39 100644 --- a/boost/intrusive/detail/slist_iterator.hpp +++ b/boost/intrusive/detail/slist_iterator.hpp @@ -49,6 +49,11 @@ class slist_iterator typedef typename types_t::node node; typedef typename types_t::node_ptr node_ptr; typedef typename types_t::const_value_traits_ptr const_value_traits_ptr; + class nat; + typedef typename + detail::if_c< IsConst + , slist_iterator<value_traits, false> + , nat>::type nonconst_iterator; public: typedef typename types_t::iterator_type::difference_type difference_type; @@ -64,10 +69,17 @@ class slist_iterator : members_(nodeptr, traits_ptr) {} - BOOST_INTRUSIVE_FORCEINLINE slist_iterator(slist_iterator<ValueTraits, false> const& other) + BOOST_INTRUSIVE_FORCEINLINE slist_iterator(const slist_iterator &other) : members_(other.pointed_node(), other.get_value_traits()) {} + BOOST_INTRUSIVE_FORCEINLINE slist_iterator(const nonconst_iterator &other) + : members_(other.pointed_node(), other.get_value_traits()) + {} + + BOOST_INTRUSIVE_FORCEINLINE slist_iterator &operator=(const slist_iterator &other) + { members_.nodeptr_ = other.members_.nodeptr_; return *this; } + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const { return members_.nodeptr_; } diff --git a/boost/intrusive/detail/tree_iterator.hpp b/boost/intrusive/detail/tree_iterator.hpp index a4bbc1b066..41988cf180 100644 --- a/boost/intrusive/detail/tree_iterator.hpp +++ b/boost/intrusive/detail/tree_iterator.hpp @@ -55,6 +55,11 @@ class tree_iterator void unspecified_bool_type_func() const {} typedef void (tree_iterator::*unspecified_bool_type)() const; + class nat; + typedef typename + detail::if_c< IsConst + , tree_iterator<value_traits, false> + , nat>::type nonconst_iterator; public: typedef typename types_t::iterator_type::difference_type difference_type; @@ -70,21 +75,28 @@ class tree_iterator : members_(nodeptr, traits_ptr) {} - BOOST_INTRUSIVE_FORCEINLINE tree_iterator(tree_iterator<value_traits, false> const& other) + BOOST_INTRUSIVE_FORCEINLINE tree_iterator(const tree_iterator &other) : members_(other.pointed_node(), other.get_value_traits()) {} - BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const - { return members_.nodeptr_; } + BOOST_INTRUSIVE_FORCEINLINE tree_iterator(const nonconst_iterator &other) + : members_(other.pointed_node(), other.get_value_traits()) + {} + + BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const tree_iterator &other) + { members_.nodeptr_ = other.members_.nodeptr_; return *this; } BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const node_ptr &nodeptr) - { members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); } + { members_.nodeptr_ = nodeptr; return *this; } + + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const + { return members_.nodeptr_; } public: - tree_iterator& operator++() + BOOST_INTRUSIVE_FORCEINLINE tree_iterator& operator++() { members_.nodeptr_ = node_algorithms::next_node(members_.nodeptr_); - return static_cast<tree_iterator&> (*this); + return *this; } tree_iterator operator++(int) @@ -94,10 +106,10 @@ class tree_iterator return result; } - tree_iterator& operator--() + BOOST_INTRUSIVE_FORCEINLINE tree_iterator& operator--() { members_.nodeptr_ = node_algorithms::prev_node(members_.nodeptr_); - return static_cast<tree_iterator&> (*this); + return *this; } tree_iterator operator--(int) @@ -110,19 +122,19 @@ class tree_iterator BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_left() { members_.nodeptr_ = node_traits::get_left(members_.nodeptr_); - return static_cast<tree_iterator&> (*this); + return *this; } BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_right() { members_.nodeptr_ = node_traits::get_right(members_.nodeptr_); - return static_cast<tree_iterator&> (*this); + return *this; } BOOST_INTRUSIVE_FORCEINLINE tree_iterator& go_parent() { members_.nodeptr_ = node_traits::get_parent(members_.nodeptr_); - return static_cast<tree_iterator&> (*this); + return *this; } BOOST_INTRUSIVE_FORCEINLINE operator unspecified_bool_type() const diff --git a/boost/intrusive/detail/workaround.hpp b/boost/intrusive/detail/workaround.hpp index 594ac0b2e5..a9e157077a 100644 --- a/boost/intrusive/detail/workaround.hpp +++ b/boost/intrusive/detail/workaround.hpp @@ -34,7 +34,7 @@ #define BOOST_INTRUSIVE_I , #define BOOST_INTRUSIVE_DOCIGN(T1) T1 -#define BOOST_INTRUSIVE_DISABLE_FORCEINLINE +//#define BOOST_INTRUSIVE_DISABLE_FORCEINLINE #if defined(BOOST_INTRUSIVE_DISABLE_FORCEINLINE) #define BOOST_INTRUSIVE_FORCEINLINE inline diff --git a/boost/intrusive/hashtable.hpp b/boost/intrusive/hashtable.hpp index 1f1f169671..1fada98f89 100644 --- a/boost/intrusive/hashtable.hpp +++ b/boost/intrusive/hashtable.hpp @@ -292,7 +292,7 @@ struct unordered_bucket_impl typedef typename get_slist_impl_from_supposed_value_traits <SupposedValueTraits>::type slist_impl; - typedef detail::bucket_impl<slist_impl> implementation_defined; + typedef bucket_impl<slist_impl> implementation_defined; typedef implementation_defined type; }; @@ -569,7 +569,7 @@ struct unordered_default_bucket_traits typedef typename detail:: get_slist_impl_from_supposed_value_traits <supposed_value_traits>::type slist_impl; - typedef detail::bucket_traits_impl + typedef bucket_traits_impl <slist_impl> implementation_defined; typedef implementation_defined type; }; @@ -604,10 +604,10 @@ struct downcast_node_to_value_t : public detail::node_to_value<ValueTraits, IsConst> { typedef detail::node_to_value<ValueTraits, IsConst> base_t; - typedef typename base_t::result_type result_type; + typedef typename base_t::result_type result_type; typedef ValueTraits value_traits; - typedef typename detail::get_slist_impl - <typename detail::reduced_slist_node_traits + typedef typename get_slist_impl + <typename reduced_slist_node_traits <typename value_traits::node_traits>::type >::type slist_impl; typedef typename detail::add_const_if_c @@ -669,7 +669,7 @@ struct bucket_plus_vtraits typedef typename value_traits::node_traits node_traits; typedef unordered_group_adapter<node_traits> group_traits; typedef typename slist_impl::iterator siterator; - typedef detail::bucket_impl<slist_impl> bucket_type; + typedef bucket_impl<slist_impl> bucket_type; typedef detail::group_functions<node_traits> group_functions_t; typedef typename slist_impl::node_algorithms node_algorithms; typedef typename slist_impl::node_ptr slist_node_ptr; @@ -1135,7 +1135,7 @@ struct bucket_hash_equal_t typedef BucketTraits bucket_traits; typedef typename bucket_plus_vtraits_t::slist_impl slist_impl; typedef typename slist_impl::iterator siterator; - typedef detail::bucket_impl<slist_impl> bucket_type; + typedef bucket_impl<slist_impl> bucket_type; typedef typename detail::unordered_bucket_ptr_impl<value_traits>::type bucket_ptr; template<class BucketTraitsType> @@ -1386,8 +1386,8 @@ struct hashdata_internal typedef typename node_traits::node_ptr node_ptr; typedef typename node_traits::const_node_ptr const_node_ptr; typedef detail::node_functions<node_traits> node_functions_t; - typedef typename detail::get_slist_impl - <typename detail::reduced_slist_node_traits + typedef typename get_slist_impl + <typename reduced_slist_node_traits <typename value_traits::node_traits>::type >::type slist_impl; typedef typename slist_impl::node_algorithms node_algorithms; @@ -1697,7 +1697,7 @@ class hashtable_impl typedef SizeType size_type; typedef typename internal_type::key_equal key_equal; typedef typename internal_type::hasher hasher; - typedef detail::bucket_impl<slist_impl> bucket_type; + typedef bucket_impl<slist_impl> bucket_type; typedef typename internal_type::bucket_ptr bucket_ptr; typedef typename slist_impl::iterator siterator; typedef typename slist_impl::const_iterator const_siterator; @@ -3515,14 +3515,10 @@ class hashtable_impl }; /// @cond -#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) template < class T , bool UniqueKeys , class PackedOptions > -#else -template <class T, bool UniqueKeys, class ...Options> -#endif struct make_bucket_traits { //Real value traits must be calculated from options @@ -3532,8 +3528,8 @@ struct make_bucket_traits typedef typename PackedOptions::bucket_traits specified_bucket_traits; //Real bucket traits must be calculated from options and calculated value_traits - typedef typename detail::get_slist_impl - <typename detail::reduced_slist_node_traits + typedef typename get_slist_impl + <typename reduced_slist_node_traits <typename value_traits::node_traits>::type >::type slist_impl; @@ -3542,7 +3538,7 @@ struct make_bucket_traits < specified_bucket_traits , default_bucket_traits >::value - , detail::bucket_traits_impl<slist_impl> + , bucket_traits_impl<slist_impl> , specified_bucket_traits >::type type; }; diff --git a/boost/intrusive/intrusive_fwd.hpp b/boost/intrusive/intrusive_fwd.hpp index f51276d636..37cdb6613e 100644 --- a/boost/intrusive/intrusive_fwd.hpp +++ b/boost/intrusive/intrusive_fwd.hpp @@ -384,6 +384,7 @@ template , class O4 = void , class O5 = void , class O6 = void + , class O7 = void > #else template<class T, class ...Options> @@ -399,6 +400,7 @@ template , class O4 = void , class O5 = void , class O6 = void + , class O7 = void > #else template<class T, class ...Options> @@ -414,6 +416,7 @@ template , class O4 = void , class O5 = void , class O6 = void + , class O7 = void > #else template<class T, class ...Options> diff --git a/boost/intrusive/list.hpp b/boost/intrusive/list.hpp index 71eac5c42e..4313f124f5 100644 --- a/boost/intrusive/list.hpp +++ b/boost/intrusive/list.hpp @@ -1471,38 +1471,38 @@ class list typedef typename Base::iterator iterator; typedef typename Base::const_iterator const_iterator; - list() + BOOST_INTRUSIVE_FORCEINLINE list() : Base() {} - explicit list(const value_traits &v_traits) + BOOST_INTRUSIVE_FORCEINLINE explicit list(const value_traits &v_traits) : Base(v_traits) {} template<class Iterator> - list(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE list(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) : Base(b, e, v_traits) {} - list(BOOST_RV_REF(list) x) + BOOST_INTRUSIVE_FORCEINLINE list(BOOST_RV_REF(list) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - list& operator=(BOOST_RV_REF(list) x) + BOOST_INTRUSIVE_FORCEINLINE list& operator=(BOOST_RV_REF(list) x) { return static_cast<list &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const list &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const list &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(list) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(list) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static list &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static list &container_from_end_iterator(iterator end_iterator) { return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); } - static const list &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const list &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const list &>(Base::container_from_end_iterator(end_iterator)); } }; diff --git a/boost/intrusive/options.hpp b/boost/intrusive/options.hpp index 6523ffb574..8bf9ca8a88 100644 --- a/boost/intrusive/options.hpp +++ b/boost/intrusive/options.hpp @@ -17,7 +17,6 @@ #include <boost/intrusive/intrusive_fwd.hpp> #include <boost/intrusive/link_mode.hpp> #include <boost/intrusive/pack_options.hpp> -#include <boost/intrusive/detail/mpl.hpp> #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once @@ -70,6 +69,15 @@ BOOST_INTRUSIVE_OPTION_TYPE(compare, Compare, Compare, compare) //!that will return the key from a value_type of an associative container BOOST_INTRUSIVE_OPTION_TYPE(key_of_value, KeyOfValue, KeyOfValue, key_of_value) +//!This option setter specifies a function object +//!that specifies the type of the priority of a treap +//!container and an operator to obtain it from a value type. +//! +//!This function object must the define a `type` member typedef and +//!a member with signature `type [const&] operator()(const value_type &) const` +//!that will return the priority from a value_type of a treap container +BOOST_INTRUSIVE_OPTION_TYPE(priority_of_value, PrioOfValue, PrioOfValue, priority_of_value) + //!This option setter for scapegoat containers specifies if //!the intrusive scapegoat container should use a non-variable //!alpha value that does not need floating-point operations. diff --git a/boost/intrusive/pointer_traits.hpp b/boost/intrusive/pointer_traits.hpp index 4216c7ee9c..9e8d36496d 100644 --- a/boost/intrusive/pointer_traits.hpp +++ b/boost/intrusive/pointer_traits.hpp @@ -123,7 +123,7 @@ struct pointer_traits //! //! <b>Note</b>: For non-conforming compilers only the existence of a member function called //! <code>pointer_to</code> is checked. - static pointer pointer_to(reference r) + BOOST_INTRUSIVE_FORCEINLINE static pointer pointer_to(reference r) { //Non-standard extension, it does not require Ptr::pointer_to. If not present //tries to converts &r to pointer. @@ -143,7 +143,7 @@ struct pointer_traits //! <b>Note</b>: For non-conforming compilers only the existence of a member function called //! <code>static_cast_from</code> is checked. template<class UPtr> - static pointer static_cast_from(const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer static_cast_from(const UPtr &uptr) { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -164,7 +164,7 @@ struct pointer_traits //! <b>Note</b>: For non-conforming compilers only the existence of a member function called //! <code>const_cast_from</code> is checked. template<class UPtr> - static pointer const_cast_from(const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer const_cast_from(const UPtr &uptr) { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -185,7 +185,7 @@ struct pointer_traits //! <b>Note</b>: For non-conforming compilers only the existence of a member function called //! <code>dynamic_cast_from</code> is checked. template<class UPtr> - static pointer dynamic_cast_from(const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer dynamic_cast_from(const UPtr &uptr) { typedef const UPtr &RefArg; const bool value = boost::intrusive::detail:: @@ -201,46 +201,46 @@ struct pointer_traits private: //priv_to_raw_pointer template <class T> - static T* to_raw_pointer(T* p) + BOOST_INTRUSIVE_FORCEINLINE static T* to_raw_pointer(T* p) { return p; } template <class Pointer> - static typename pointer_traits<Pointer>::element_type* + BOOST_INTRUSIVE_FORCEINLINE static typename pointer_traits<Pointer>::element_type* to_raw_pointer(const Pointer &p) { return pointer_traits::to_raw_pointer(p.operator->()); } //priv_pointer_to - static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r) { return Ptr::pointer_to(r); } - static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r) { return pointer(boost::intrusive::detail::addressof(r)); } //priv_static_cast_from template<class UPtr> - static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) { return Ptr::static_cast_from(uptr); } template<class UPtr> - static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) { return uptr ? pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))) : pointer(); } //priv_const_cast_from template<class UPtr> - static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) { return Ptr::const_cast_from(uptr); } template<class UPtr> - static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) { return uptr ? pointer_to(const_cast<element_type&>(*uptr)) : pointer(); } //priv_dynamic_cast_from template<class UPtr> - static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr) { return Ptr::dynamic_cast_from(uptr); } template<class UPtr> - static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) + BOOST_INTRUSIVE_FORCEINLINE static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr) { return uptr ? pointer_to(dynamic_cast<element_type&>(*uptr)) : pointer(); } ///@endcond }; diff --git a/boost/intrusive/priority_compare.hpp b/boost/intrusive/priority_compare.hpp index f5589ce27b..3cf2b1c622 100644 --- a/boost/intrusive/priority_compare.hpp +++ b/boost/intrusive/priority_compare.hpp @@ -60,14 +60,14 @@ struct priority_compare<void> /// @cond template<class PrioComp, class T> -struct get_prio +struct get_prio_comp { typedef PrioComp type; }; template<class T> -struct get_prio<void, T> +struct get_prio_comp<void, T> { typedef ::boost::intrusive::priority_compare<T> type; }; diff --git a/boost/intrusive/rbtree.hpp b/boost/intrusive/rbtree.hpp index 4f5d86dd6a..9d9b1169df 100644 --- a/boost/intrusive/rbtree.hpp +++ b/boost/intrusive/rbtree.hpp @@ -538,46 +538,46 @@ class rbtree //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - rbtree() + BOOST_INTRUSIVE_FORCEINLINE rbtree() : Base() {} - explicit rbtree( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit rbtree( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - rbtree( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE rbtree( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, v_traits) {} - rbtree(BOOST_RV_REF(rbtree) x) + BOOST_INTRUSIVE_FORCEINLINE rbtree(BOOST_RV_REF(rbtree) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - rbtree& operator=(BOOST_RV_REF(rbtree) x) + BOOST_INTRUSIVE_FORCEINLINE rbtree& operator=(BOOST_RV_REF(rbtree) x) { return static_cast<rbtree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const rbtree &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const rbtree &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(rbtree) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(rbtree) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static rbtree &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static rbtree &container_from_end_iterator(iterator end_iterator) { return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); } - static const rbtree &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const rbtree &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const rbtree &>(Base::container_from_end_iterator(end_iterator)); } - static rbtree &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static rbtree &container_from_iterator(iterator it) { return static_cast<rbtree &>(Base::container_from_iterator(it)); } - static const rbtree &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const rbtree &container_from_iterator(const_iterator it) { return static_cast<const rbtree &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/rbtree_algorithms.hpp b/boost/intrusive/rbtree_algorithms.hpp index ee5e13a7aa..3f3bc25079 100644 --- a/boost/intrusive/rbtree_algorithms.hpp +++ b/boost/intrusive/rbtree_algorithms.hpp @@ -273,7 +273,7 @@ class rbtree_algorithms #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) - static void init_header(node_ptr header) + BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr header) { bstree_algo::init_header(header); NodeTraits::set_color(header, NodeTraits::red()); diff --git a/boost/intrusive/set.hpp b/boost/intrusive/set.hpp index 3cd9013d4b..366931f54f 100644 --- a/boost/intrusive/set.hpp +++ b/boost/intrusive/set.hpp @@ -525,46 +525,46 @@ class set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - set() + BOOST_INTRUSIVE_FORCEINLINE set() : Base() {} - explicit set( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit set( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - set(BOOST_RV_REF(set) x) + BOOST_INTRUSIVE_FORCEINLINE set(BOOST_RV_REF(set) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - set& operator=(BOOST_RV_REF(set) x) + BOOST_INTRUSIVE_FORCEINLINE set& operator=(BOOST_RV_REF(set) x) { return static_cast<set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static set &container_from_end_iterator(iterator end_iterator) { return static_cast<set &>(Base::container_from_end_iterator(end_iterator)); } - static const set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const set &>(Base::container_from_end_iterator(end_iterator)); } - static set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static set &container_from_iterator(iterator it) { return static_cast<set &>(Base::container_from_iterator(it)); } - static const set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const set &container_from_iterator(const_iterator it) { return static_cast<const set &>(Base::container_from_iterator(it)); } }; @@ -1020,46 +1020,46 @@ class multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - multiset() + BOOST_INTRUSIVE_FORCEINLINE multiset() : Base() {} - explicit multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - multiset(BOOST_RV_REF(multiset) x) + BOOST_INTRUSIVE_FORCEINLINE multiset(BOOST_RV_REF(multiset) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - multiset& operator=(BOOST_RV_REF(multiset) x) + BOOST_INTRUSIVE_FORCEINLINE multiset& operator=(BOOST_RV_REF(multiset) x) { return static_cast<multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const multiset &>(Base::container_from_end_iterator(end_iterator)); } - static multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static multiset &container_from_iterator(iterator it) { return static_cast<multiset &>(Base::container_from_iterator(it)); } - static const multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const multiset &container_from_iterator(const_iterator it) { return static_cast<const multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/sg_set.hpp b/boost/intrusive/sg_set.hpp index 745c3790b9..4144e14ba2 100644 --- a/boost/intrusive/sg_set.hpp +++ b/boost/intrusive/sg_set.hpp @@ -534,46 +534,46 @@ class sg_set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - sg_set() + BOOST_INTRUSIVE_FORCEINLINE sg_set() : Base() {} - explicit sg_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit sg_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - sg_set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE sg_set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - sg_set(BOOST_RV_REF(sg_set) x) + BOOST_INTRUSIVE_FORCEINLINE sg_set(BOOST_RV_REF(sg_set) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - sg_set& operator=(BOOST_RV_REF(sg_set) x) + BOOST_INTRUSIVE_FORCEINLINE sg_set& operator=(BOOST_RV_REF(sg_set) x) { return static_cast<sg_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const sg_set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const sg_set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(sg_set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(sg_set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static sg_set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static sg_set &container_from_end_iterator(iterator end_iterator) { return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); } - static const sg_set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const sg_set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const sg_set &>(Base::container_from_end_iterator(end_iterator)); } - static sg_set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static sg_set &container_from_iterator(iterator it) { return static_cast<sg_set &>(Base::container_from_iterator(it)); } - static const sg_set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const sg_set &container_from_iterator(const_iterator it) { return static_cast<const sg_set &>(Base::container_from_iterator(it)); } }; @@ -1041,46 +1041,46 @@ class sg_multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - sg_multiset() + BOOST_INTRUSIVE_FORCEINLINE sg_multiset() : Base() {} - explicit sg_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit sg_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - sg_multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE sg_multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - sg_multiset(BOOST_RV_REF(sg_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE sg_multiset(BOOST_RV_REF(sg_multiset) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x) { return static_cast<sg_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const sg_multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const sg_multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(sg_multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(sg_multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static sg_multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static sg_multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const sg_multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const sg_multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const sg_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static sg_multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static sg_multiset &container_from_iterator(iterator it) { return static_cast<sg_multiset &>(Base::container_from_iterator(it)); } - static const sg_multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const sg_multiset &container_from_iterator(const_iterator it) { return static_cast<const sg_multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/sgtree.hpp b/boost/intrusive/sgtree.hpp index 033efb878d..89a97a147c 100644 --- a/boost/intrusive/sgtree.hpp +++ b/boost/intrusive/sgtree.hpp @@ -1028,46 +1028,46 @@ class sgtree //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - sgtree() + BOOST_INTRUSIVE_FORCEINLINE sgtree() : Base() {} - explicit sgtree(const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit sgtree(const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - sgtree( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE sgtree( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, v_traits) {} - sgtree(BOOST_RV_REF(sgtree) x) + BOOST_INTRUSIVE_FORCEINLINE sgtree(BOOST_RV_REF(sgtree) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - sgtree& operator=(BOOST_RV_REF(sgtree) x) + BOOST_INTRUSIVE_FORCEINLINE sgtree& operator=(BOOST_RV_REF(sgtree) x) { return static_cast<sgtree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const sgtree &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const sgtree &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(sgtree) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(sgtree) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static sgtree &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static sgtree &container_from_end_iterator(iterator end_iterator) { return static_cast<sgtree &>(Base::container_from_end_iterator(end_iterator)); } - static const sgtree &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const sgtree &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const sgtree &>(Base::container_from_end_iterator(end_iterator)); } - static sgtree &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static sgtree &container_from_iterator(iterator it) { return static_cast<sgtree &>(Base::container_from_iterator(it)); } - static const sgtree &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const sgtree &container_from_iterator(const_iterator it) { return static_cast<const sgtree &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/slist.hpp b/boost/intrusive/slist.hpp index 1dc90a80a9..08797e3f53 100644 --- a/boost/intrusive/slist.hpp +++ b/boost/intrusive/slist.hpp @@ -233,7 +233,7 @@ class slist_impl {}; struct data_t - : public slist_impl::value_traits + : public value_traits { typedef typename slist_impl::value_traits value_traits; explicit data_t(const value_traits &val_traits) @@ -2202,45 +2202,45 @@ class slist typedef typename Base::size_type size_type; typedef typename Base::node_ptr node_ptr; - slist() + BOOST_INTRUSIVE_FORCEINLINE slist() : Base() {} - explicit slist(const value_traits &v_traits) + BOOST_INTRUSIVE_FORCEINLINE explicit slist(const value_traits &v_traits) : Base(v_traits) {} struct incorporate_t{}; - slist( const node_ptr & f, const node_ptr & before_l + BOOST_INTRUSIVE_FORCEINLINE slist( const node_ptr & f, const node_ptr & before_l , size_type n, const value_traits &v_traits = value_traits()) : Base(f, before_l, n, v_traits) {} template<class Iterator> - slist(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE slist(Iterator b, Iterator e, const value_traits &v_traits = value_traits()) : Base(b, e, v_traits) {} - slist(BOOST_RV_REF(slist) x) + BOOST_INTRUSIVE_FORCEINLINE slist(BOOST_RV_REF(slist) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - slist& operator=(BOOST_RV_REF(slist) x) + BOOST_INTRUSIVE_FORCEINLINE slist& operator=(BOOST_RV_REF(slist) x) { return static_cast<slist &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const slist &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const slist &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(slist) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(slist) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static slist &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static slist &container_from_end_iterator(iterator end_iterator) { return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); } - static const slist &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const slist &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const slist &>(Base::container_from_end_iterator(end_iterator)); } }; diff --git a/boost/intrusive/splay_set.hpp b/boost/intrusive/splay_set.hpp index da7662eeb1..9f6e92e934 100644 --- a/boost/intrusive/splay_set.hpp +++ b/boost/intrusive/splay_set.hpp @@ -546,46 +546,46 @@ class splay_set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - splay_set() + BOOST_INTRUSIVE_FORCEINLINE splay_set() : Base() {} - explicit splay_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit splay_set( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - splay_set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE splay_set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - splay_set(BOOST_RV_REF(splay_set) x) + BOOST_INTRUSIVE_FORCEINLINE splay_set(BOOST_RV_REF(splay_set) x) : Base(::boost::move(static_cast<Base&>(x))) {} - splay_set& operator=(BOOST_RV_REF(splay_set) x) + BOOST_INTRUSIVE_FORCEINLINE splay_set& operator=(BOOST_RV_REF(splay_set) x) { return static_cast<splay_set &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } template <class Cloner, class Disposer> - void clone_from(const splay_set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const splay_set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(splay_set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(splay_set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static splay_set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static splay_set &container_from_end_iterator(iterator end_iterator) { return static_cast<splay_set &>(Base::container_from_end_iterator(end_iterator)); } - static const splay_set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const splay_set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const splay_set &>(Base::container_from_end_iterator(end_iterator)); } - static splay_set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static splay_set &container_from_iterator(iterator it) { return static_cast<splay_set &>(Base::container_from_iterator(it)); } - static const splay_set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const splay_set &container_from_iterator(const_iterator it) { return static_cast<const splay_set &>(Base::container_from_iterator(it)); } }; @@ -1057,46 +1057,46 @@ class splay_multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - splay_multiset() + BOOST_INTRUSIVE_FORCEINLINE splay_multiset() : Base() {} - explicit splay_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit splay_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - splay_multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE splay_multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, v_traits) {} - splay_multiset(BOOST_RV_REF(splay_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE splay_multiset(BOOST_RV_REF(splay_multiset) x) : Base(::boost::move(static_cast<Base&>(x))) {} - splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x) { return static_cast<splay_multiset &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } template <class Cloner, class Disposer> - void clone_from(const splay_multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const splay_multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(splay_multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(splay_multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static splay_multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static splay_multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<splay_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const splay_multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const splay_multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const splay_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static splay_multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static splay_multiset &container_from_iterator(iterator it) { return static_cast<splay_multiset &>(Base::container_from_iterator(it)); } - static const splay_multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const splay_multiset &container_from_iterator(const_iterator it) { return static_cast<const splay_multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/splaytree.hpp b/boost/intrusive/splaytree.hpp index f6a1a93a9d..a93f1f7b13 100644 --- a/boost/intrusive/splaytree.hpp +++ b/boost/intrusive/splaytree.hpp @@ -613,46 +613,46 @@ class splaytree //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - splaytree() + BOOST_INTRUSIVE_FORCEINLINE splaytree() : Base() {} - explicit splaytree( const key_compare &cmp, const value_traits &v_traits = value_traits()) + BOOST_INTRUSIVE_FORCEINLINE explicit splaytree( const key_compare &cmp, const value_traits &v_traits = value_traits()) : Base(cmp, v_traits) {} template<class Iterator> - splaytree( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE splaytree( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, v_traits) {} - splaytree(BOOST_RV_REF(splaytree) x) + BOOST_INTRUSIVE_FORCEINLINE splaytree(BOOST_RV_REF(splaytree) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - splaytree& operator=(BOOST_RV_REF(splaytree) x) + BOOST_INTRUSIVE_FORCEINLINE splaytree& operator=(BOOST_RV_REF(splaytree) x) { return static_cast<splaytree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const splaytree &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const splaytree &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(splaytree) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(splaytree) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static splaytree &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static splaytree &container_from_end_iterator(iterator end_iterator) { return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator)); } - static const splaytree &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const splaytree &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const splaytree &>(Base::container_from_end_iterator(end_iterator)); } - static splaytree &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static splaytree &container_from_iterator(iterator it) { return static_cast<splaytree &>(Base::container_from_iterator(it)); } - static const splaytree &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const splaytree &container_from_iterator(const_iterator it) { return static_cast<const splaytree &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/treap.hpp b/boost/intrusive/treap.hpp index c6f63ff2de..56569757c8 100644 --- a/boost/intrusive/treap.hpp +++ b/boost/intrusive/treap.hpp @@ -50,8 +50,24 @@ struct treap_defaults : bstree_defaults { typedef void priority; + typedef void priority_of_value; }; +template<class ValuePtr, class VoidOrPrioOfValue, class VoidOrPrioComp> +struct treap_prio_types +{ + typedef typename + boost::movelib::pointer_element<ValuePtr>::type value_type; + typedef typename get_key_of_value + < VoidOrPrioOfValue, value_type>::type priority_of_value; + typedef typename priority_of_value::type priority_type; + typedef typename get_prio_comp< VoidOrPrioComp + , priority_type + >::type priority_compare; +}; + +struct treap_tag; + /// @endcond //! The class template treap is an intrusive treap container that @@ -70,18 +86,15 @@ struct treap_defaults #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) template<class T, class ...Options> #else -template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> +template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioOfValue, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> #endif class treap_impl /// @cond : public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> //Use public inheritance to avoid MSVC bugs with closures , public detail::ebo_functor_holder - < typename get_prio - < VoidOrPrioComp - , typename bstree_impl - <ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>::key_type>::type - > + < typename treap_prio_types<typename ValueTraits::pointer, VoidOrPrioOfValue, VoidOrPrioComp>::priority_compare + , treap_tag> /// @endcond { public: @@ -91,12 +104,12 @@ class treap_impl , ConstantTimeSize, BsTreeAlgorithms , HeaderHolder> tree_type; typedef tree_type implementation_defined; - typedef get_prio - < VoidOrPrioComp - , typename tree_type::key_type> get_prio_type; + typedef treap_prio_types + < typename ValueTraits::pointer + , VoidOrPrioOfValue, VoidOrPrioComp> treap_prio_types_t; typedef detail::ebo_functor_holder - <typename get_prio_type::type> prio_base; + <typename treap_prio_types_t::priority_compare, treap_tag> prio_base; /// @endcond @@ -120,17 +133,22 @@ class treap_impl typedef typename implementation_defined::node_ptr node_ptr; typedef typename implementation_defined::const_node_ptr const_node_ptr; typedef BOOST_INTRUSIVE_IMPDEF(treap_algorithms<node_traits>) node_algorithms; - typedef BOOST_INTRUSIVE_IMPDEF(typename get_prio_type::type) priority_compare; + typedef BOOST_INTRUSIVE_IMPDEF + (typename treap_prio_types_t::priority_type) priority_type; + typedef BOOST_INTRUSIVE_IMPDEF + (typename treap_prio_types_t::priority_of_value) priority_of_value; + typedef BOOST_INTRUSIVE_IMPDEF + (typename treap_prio_types_t::priority_compare) priority_compare; static const bool constant_time_size = implementation_defined::constant_time_size; static const bool stateful_value_traits = implementation_defined::stateful_value_traits; static const bool safemode_or_autounlink = is_safe_autounlink<value_traits::link_mode>::value; - typedef detail::key_nodeptr_comp<priority_compare, value_traits, key_of_value> key_node_prio_comp_t; + typedef detail::key_nodeptr_comp<priority_compare, value_traits, priority_of_value> prio_node_prio_comp_t; - template<class KeyPrioComp> - detail::key_nodeptr_comp<KeyPrioComp, value_traits, key_of_value> key_node_prio_comp(KeyPrioComp keypriocomp) const - { return detail::key_nodeptr_comp<KeyPrioComp, value_traits, key_of_value>(keypriocomp, &this->get_value_traits()); } + template<class PrioPrioComp> + detail::key_nodeptr_comp<PrioPrioComp, value_traits, priority_of_value> prio_node_prio_comp(PrioPrioComp priopriocomp) const + { return detail::key_nodeptr_comp<PrioPrioComp, value_traits, priority_of_value>(priopriocomp, &this->get_value_traits()); } /// @cond private: @@ -157,7 +175,7 @@ class treap_impl //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) //! or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee. treap_impl() - : tree_type(), prio_base(priority_compare()) + : tree_type(), prio_base() {} //! <b>Effects</b>: Constructs an empty container. @@ -421,7 +439,7 @@ class treap_impl ( this->tree_type::header_ptr() , to_insert , this->key_node_comp(this->key_comp()) - , this->key_node_prio_comp(this->priv_pcomp())) + , this->prio_node_prio_comp(this->priv_pcomp())) , this->priv_value_traits_ptr()); this->tree_type::sz_traits().increment(); return ret; @@ -451,7 +469,7 @@ class treap_impl , hint.pointed_node() , to_insert , this->key_node_comp(this->key_comp()) - , this->key_node_prio_comp(this->priv_pcomp())) + , this->prio_node_prio_comp(this->priv_pcomp())) , this->priv_value_traits_ptr()); this->tree_type::sz_traits().increment(); return ret; @@ -496,7 +514,7 @@ class treap_impl std::pair<iterator, bool> insert_unique(reference value) { insert_commit_data commit_data; - std::pair<iterator, bool> ret = this->insert_unique_check(key_of_value()(value), commit_data); + std::pair<iterator, bool> ret = this->insert_unique_check(key_of_value()(value), priority_of_value()(value), commit_data); if(!ret.second) return ret; return std::pair<iterator, bool> (this->insert_unique_commit(value, commit_data), true); @@ -520,7 +538,7 @@ class treap_impl iterator insert_unique(const_iterator hint, reference value) { insert_commit_data commit_data; - std::pair<iterator, bool> ret = this->insert_unique_check(hint, key_of_value()(value), commit_data); + std::pair<iterator, bool> ret = this->insert_unique_check(hint, key_of_value()(value), priority_of_value()(value), commit_data); if(!ret.second) return ret.first; return this->insert_unique_commit(value, commit_data); @@ -581,8 +599,8 @@ class treap_impl //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. std::pair<iterator, bool> insert_unique_check - ( const key_type &key, insert_commit_data &commit_data) - { return this->insert_unique_check(key, this->key_comp(), this->priv_pcomp(), commit_data); } + ( const key_type &key, const priority_type &prio, insert_commit_data &commit_data) + { return this->insert_unique_check(key, this->key_comp(), prio, this->priv_pcomp(), commit_data); } //! <b>Effects</b>: Checks if a value can be inserted in the container, using //! a user provided key instead of the value itself, using "hint" @@ -613,14 +631,14 @@ class treap_impl //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. std::pair<iterator, bool> insert_unique_check - ( const_iterator hint, const key_type &key, insert_commit_data &commit_data) - { return this->insert_unique_check(hint, key, this->key_comp(), this->priv_pcomp(), commit_data); } + ( const_iterator hint, const key_type &key, const priority_type &prio, insert_commit_data &commit_data) + { return this->insert_unique_check(hint, key, this->key_comp(), prio, this->priv_pcomp(), commit_data); } //! <b>Requires</b>: comp must be a comparison function that induces //! the same strict weak ordering as key_compare. - //! key_value_pcomp must be a comparison function that induces + //! prio_value_pcomp must be a comparison function that induces //! the same strict weak ordering as priority_compare. The difference is that - //! key_value_pcomp and comp compare an arbitrary key with the contained values. + //! prio_value_pcomp and comp compare an arbitrary key/priority with the contained values. //! //! <b>Effects</b>: Checks if a value can be inserted in the container, using //! a user provided key instead of the value itself. @@ -633,7 +651,7 @@ class treap_impl //! //! <b>Complexity</b>: Average complexity is at most logarithmic. //! - //! <b>Throws</b>: If the comp or key_value_pcomp + //! <b>Throws</b>: If the comp or prio_value_pcomp //! ordering functions throw. Strong guarantee. //! //! <b>Notes</b>: This function is used to improve performance when constructing @@ -649,27 +667,29 @@ class treap_impl //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. - template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare> + template<class KeyType, class KeyTypeKeyCompare, class PrioType, class PrioValuePrioCompare> BOOST_INTRUSIVE_DOC1ST(std::pair<iterator BOOST_INTRUSIVE_I bool> , typename detail::disable_if_convertible <KeyType BOOST_INTRUSIVE_I const_iterator BOOST_INTRUSIVE_I std::pair<iterator BOOST_INTRUSIVE_I bool> >::type) insert_unique_check ( const KeyType &key, KeyTypeKeyCompare comp - , KeyValuePrioCompare key_value_pcomp, insert_commit_data &commit_data) + , const PrioType &prio, PrioValuePrioCompare prio_value_pcomp, insert_commit_data &commit_data) { std::pair<node_ptr, bool> const ret = (node_algorithms::insert_unique_check - ( this->tree_type::header_ptr(), key - , this->key_node_comp(comp), this->key_node_prio_comp(key_value_pcomp), commit_data)); + ( this->tree_type::header_ptr() + , key, this->key_node_comp(comp) + , prio, this->prio_node_prio_comp(prio_value_pcomp) + , commit_data)); return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second); } //! <b>Requires</b>: comp must be a comparison function that induces //! the same strict weak ordering as key_compare. - //! key_value_pcomp must be a comparison function that induces + //! prio_value_pcomp must be a comparison function that induces //! the same strict weak ordering as priority_compare. The difference is that - //! key_value_pcomp and comp compare an arbitrary key with the contained values. + //! prio_value_pcomp and comp compare an arbitrary key/priority with the contained values. //! //! <b>Effects</b>: Checks if a value can be inserted in the container, using //! a user provided key instead of the value itself, using "hint" @@ -684,7 +704,7 @@ class treap_impl //! <b>Complexity</b>: Logarithmic in general, but it's amortized //! constant time if t is inserted immediately before hint. //! - //! <b>Throws</b>: If the comp or key_value_pcomp + //! <b>Throws</b>: If the comp or prio_value_pcomp //! ordering functions throw. Strong guarantee. //! //! <b>Notes</b>: This function is used to improve performance when constructing @@ -700,17 +720,21 @@ class treap_impl //! //! "commit_data" remains valid for a subsequent "insert_commit" only if no more //! objects are inserted or erased from the container. - template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare> + template<class KeyType, class KeyTypeKeyCompare, class PrioType, class PrioValuePrioCompare> std::pair<iterator, bool> insert_unique_check - ( const_iterator hint, const KeyType &key + ( const_iterator hint + , const KeyType &key , KeyTypeKeyCompare comp - , KeyValuePrioCompare key_value_pcomp + , const PrioType &prio + , PrioValuePrioCompare prio_value_pcomp , insert_commit_data &commit_data) { std::pair<node_ptr, bool> const ret = (node_algorithms::insert_unique_check - ( this->tree_type::header_ptr(), hint.pointed_node(), key - , this->key_node_comp(comp), this->key_node_prio_comp(key_value_pcomp), commit_data)); + ( this->tree_type::header_ptr(), hint.pointed_node() + , key, this->key_node_comp(comp) + , prio, this->prio_node_prio_comp(prio_value_pcomp) + , commit_data)); return std::pair<iterator, bool>(iterator(ret.first, this->priv_value_traits_ptr()), ret.second); } @@ -763,7 +787,7 @@ class treap_impl ( this->tree_type::header_ptr() , pos.pointed_node() , to_insert - , this->key_node_prio_comp(this->priv_pcomp()) + , this->prio_node_prio_comp(this->priv_pcomp()) ) , this->priv_value_traits_ptr()); this->tree_type::sz_traits().increment(); @@ -789,7 +813,7 @@ class treap_impl node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert)); node_algorithms::push_back - (this->tree_type::header_ptr(), to_insert, this->key_node_prio_comp(this->priv_pcomp())); + (this->tree_type::header_ptr(), to_insert, this->prio_node_prio_comp(this->priv_pcomp())); this->tree_type::sz_traits().increment(); } @@ -812,7 +836,7 @@ class treap_impl node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert)); node_algorithms::push_front - (this->tree_type::header_ptr(), to_insert, this->key_node_prio_comp(this->priv_pcomp())); + (this->tree_type::header_ptr(), to_insert, this->prio_node_prio_comp(this->priv_pcomp())); this->tree_type::sz_traits().increment(); } @@ -831,7 +855,7 @@ class treap_impl node_ptr to_erase(i.pointed_node()); BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || !node_algorithms::unique(to_erase)); node_algorithms::erase - (this->tree_type::header_ptr(), to_erase, this->key_node_prio_comp(this->priv_pcomp())); + (this->tree_type::header_ptr(), to_erase, this->prio_node_prio_comp(this->priv_pcomp())); this->tree_type::sz_traits().decrement(); if(safemode_or_autounlink) node_algorithms::init(to_erase); @@ -1013,7 +1037,7 @@ class treap_impl #else template<class Compare2> void merge_unique(treap_impl - <ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + <ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) #endif { node_ptr it (node_algorithms::begin_node(source.header_ptr())) @@ -1026,7 +1050,7 @@ class treap_impl if( node_algorithms::transfer_unique ( this->header_ptr(), this->key_node_comp(this->key_comp()) - , this->key_node_prio_comp(this->priv_pcomp()), source.header_ptr(), p) ){ + , this->prio_node_prio_comp(this->priv_pcomp()), source.header_ptr(), p) ){ this->sz_traits().increment(); source.sz_traits().decrement(); } @@ -1039,7 +1063,7 @@ class treap_impl #else template<class Compare2> void merge_equal(treap_impl - <ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + <ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) #endif { node_ptr it (node_algorithms::begin_node(source.header_ptr())) @@ -1051,7 +1075,7 @@ class treap_impl it = node_algorithms::next_node(it); node_algorithms::transfer_equal ( this->header_ptr(), this->key_node_comp(this->key_comp()) - , this->key_node_prio_comp(this->priv_pcomp()), source.header_ptr(), p); + , this->prio_node_prio_comp(this->priv_pcomp()), source.header_ptr(), p); this->sz_traits().increment(); source.sz_traits().decrement(); } @@ -1061,10 +1085,10 @@ class treap_impl template <class ExtraChecker> void check(ExtraChecker extra_checker) const { - typedef detail::key_nodeptr_comp<priority_compare, value_traits, key_of_value> nodeptr_prio_comp_t; + typedef detail::key_nodeptr_comp<priority_compare, value_traits, priority_of_value> nodeptr_prio_comp_t; tree_type::check(detail::treap_node_extra_checker <ValueTraits, nodeptr_prio_comp_t, ExtraChecker> - (this->key_node_prio_comp(this->priv_pcomp()), extra_checker)); + (this->prio_node_prio_comp(this->priv_pcomp()), extra_checker)); } //! @copydoc ::boost::intrusive::bstree::check()const @@ -1222,14 +1246,15 @@ template<class T, class ...Options> #else template<class T, class O1 = void, class O2 = void , class O3 = void, class O4 = void - , class O5 = void, class O6 = void> + , class O5 = void, class O6 = void + , class O7 = void> #endif struct make_treap { typedef typename pack_options < treap_defaults, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1242,6 +1267,7 @@ struct make_treap < value_traits , typename packed_options::key_of_value , typename packed_options::compare + , typename packed_options::priority_of_value , typename packed_options::priority , typename packed_options::size_type , packed_options::constant_time_size @@ -1254,14 +1280,14 @@ struct make_treap #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) -template<class T, class O1, class O2, class O3, class O4, class O5, class O6> +template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7> #else template<class T, class ...Options> #endif class treap : public make_treap<T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1270,7 +1296,7 @@ class treap typedef typename make_treap <T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1288,49 +1314,50 @@ class treap //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - treap() + + BOOST_INTRUSIVE_FORCEINLINE treap() : Base() {} - explicit treap( const key_compare &cmp + BOOST_INTRUSIVE_FORCEINLINE explicit treap( const key_compare &cmp , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(cmp, pcmp, v_traits) {} template<class Iterator> - treap( bool unique, Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE treap( bool unique, Iterator b, Iterator e , const key_compare &cmp = key_compare() , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(unique, b, e, cmp, pcmp, v_traits) {} - treap(BOOST_RV_REF(treap) x) + BOOST_INTRUSIVE_FORCEINLINE treap(BOOST_RV_REF(treap) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - treap& operator=(BOOST_RV_REF(treap) x) + BOOST_INTRUSIVE_FORCEINLINE treap& operator=(BOOST_RV_REF(treap) x) { return static_cast<treap&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const treap &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const treap &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(treap) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(treap) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static treap &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static treap &container_from_end_iterator(iterator end_iterator) { return static_cast<treap &>(Base::container_from_end_iterator(end_iterator)); } - static const treap &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const treap &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const treap &>(Base::container_from_end_iterator(end_iterator)); } - static treap &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static treap &container_from_iterator(iterator it) { return static_cast<treap &>(Base::container_from_iterator(it)); } - static const treap &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const treap &container_from_iterator(const_iterator it) { return static_cast<const treap &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/treap_algorithms.hpp b/boost/intrusive/treap_algorithms.hpp index e9b8b23397..a75b48bcca 100644 --- a/boost/intrusive/treap_algorithms.hpp +++ b/boost/intrusive/treap_algorithms.hpp @@ -481,16 +481,17 @@ class treap_algorithms //! //! "commit_data" remains valid for a subsequent "insert_unique_commit" only //! if no more objects are inserted or erased from the set. - template<class KeyType, class KeyNodePtrCompare, class KeyNodePtrPrioCompare> + template<class KeyType, class KeyNodePtrCompare, class PrioType, class PrioNodePtrPrioCompare> static std::pair<node_ptr, bool> insert_unique_check - (const_node_ptr header, const KeyType &key - ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp - ,insert_commit_data &commit_data) + ( const_node_ptr header + , const KeyType &key, KeyNodePtrCompare comp + , const PrioType &prio, PrioNodePtrPrioCompare pcomp + , insert_commit_data &commit_data) { std::pair<node_ptr, bool> ret = bstree_algo::insert_unique_check(header, key, comp, commit_data); if(ret.second) - rebalance_after_insertion_check(header, commit_data.node, key, pcomp, commit_data.rotations); + rebalance_after_insertion_check(header, commit_data.node, prio, pcomp, commit_data.rotations); return ret; } @@ -533,15 +534,17 @@ class treap_algorithms //! //! "commit_data" remains valid for a subsequent "insert_unique_commit" only //! if no more objects are inserted or erased from the set. - template<class KeyType, class KeyNodePtrCompare, class KeyNodePtrPrioCompare> + template<class KeyType, class KeyNodePtrCompare, class PrioType, class PrioNodePtrPrioCompare> static std::pair<node_ptr, bool> insert_unique_check - (const_node_ptr header, node_ptr hint, const KeyType &key - ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp, insert_commit_data &commit_data) + ( const_node_ptr header, node_ptr hint + , const KeyType &key, KeyNodePtrCompare comp + , const PrioType &prio, PrioNodePtrPrioCompare pcomp + , insert_commit_data &commit_data) { std::pair<node_ptr, bool> ret = bstree_algo::insert_unique_check(header, hint, key, comp, commit_data); if(ret.second) - rebalance_after_insertion_check(header, commit_data.node, key, pcomp, commit_data.rotations); + rebalance_after_insertion_check(header, commit_data.node, prio, pcomp, commit_data.rotations); return ret; } @@ -570,12 +573,12 @@ class treap_algorithms } //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique - template<class NodePtrCompare, class KeyNodePtrPrioCompare> + template<class NodePtrCompare, class PrioNodePtrPrioCompare> static bool transfer_unique - (node_ptr header1, NodePtrCompare comp, KeyNodePtrPrioCompare pcomp, node_ptr header2, node_ptr z) + (node_ptr header1, NodePtrCompare comp, PrioNodePtrPrioCompare pcomp, node_ptr header2, node_ptr z) { insert_commit_data commit_data; - bool const transferable = insert_unique_check(header1, z, comp, pcomp, commit_data).second; + bool const transferable = insert_unique_check(header1, z, comp, z, pcomp, commit_data).second; if(transferable){ erase(header2, z, pcomp); insert_unique_commit(header1, z, commit_data); @@ -584,9 +587,9 @@ class treap_algorithms } //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal - template<class NodePtrCompare, class KeyNodePtrPrioCompare> + template<class NodePtrCompare, class PrioNodePtrPrioCompare> static void transfer_equal - (node_ptr header1, NodePtrCompare comp, KeyNodePtrPrioCompare pcomp, node_ptr header2, node_ptr z) + (node_ptr header1, NodePtrCompare comp, PrioNodePtrPrioCompare pcomp, node_ptr header2, node_ptr z) { insert_commit_data commit_data; bstree_algo::insert_equal_upper_bound_check(header1, z, comp, commit_data); diff --git a/boost/intrusive/treap_set.hpp b/boost/intrusive/treap_set.hpp index bf162badf0..6c0ea3b643 100644 --- a/boost/intrusive/treap_set.hpp +++ b/boost/intrusive/treap_set.hpp @@ -27,7 +27,7 @@ namespace boost { namespace intrusive { #if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) -template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> +template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioOfValue, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> class treap_multiset_impl; #endif @@ -45,16 +45,16 @@ class treap_multiset_impl; #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) template<class T, class ...Options> #else -template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> +template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioOfValue, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> #endif class treap_set_impl #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED - : public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> + : public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> #endif { /// @cond public: - typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type; + typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type; BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set_impl) typedef tree_type implementation_defined; @@ -73,6 +73,7 @@ class treap_set_impl typedef typename implementation_defined::size_type size_type; typedef typename implementation_defined::value_compare value_compare; typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::priority_type priority_type; typedef typename implementation_defined::priority_compare priority_compare; typedef typename implementation_defined::iterator iterator; typedef typename implementation_defined::const_iterator const_iterator; @@ -243,29 +244,30 @@ class treap_set_impl iterator insert(const_iterator hint, reference value) { return tree_type::insert_unique(hint, value); } - //! @copydoc ::boost::intrusive::treap::insert_unique_check(const key_type&,insert_commit_data&) - std::pair<iterator, bool> insert_check( const key_type &key, insert_commit_data &commit_data) - { return tree_type::insert_unique_check(key, commit_data); } + //! @copydoc ::boost::intrusive::treap::insert_unique_check(const key_type&,const priority_type &,insert_commit_data&) + std::pair<iterator, bool> insert_check( const key_type &key, const priority_type &prio, insert_commit_data &commit_data) + { return tree_type::insert_unique_check(key, prio, commit_data); } - //! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const key_type&,insert_commit_data&) + //! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const key_type&,const priority_type &,insert_commit_data&) std::pair<iterator, bool> insert_check - ( const_iterator hint, const key_type &key, insert_commit_data &commit_data) - { return tree_type::insert_unique_check(hint, key, commit_data); } + ( const_iterator hint, const key_type &key, const priority_type &prio, insert_commit_data &commit_data) + { return tree_type::insert_unique_check(hint, key, prio, commit_data); } - //! @copydoc ::boost::intrusive::treap::insert_unique_check(const KeyType&,KeyTypeKeyCompare,KeyValuePrioCompare,insert_commit_data&) - template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare> + //! @copydoc ::boost::intrusive::treap::insert_unique_check(const KeyType&,KeyTypeKeyCompare,PrioValuePrioCompare,insert_commit_data&) + template<class KeyType, class KeyTypeKeyCompare, class PrioType, class PrioValuePrioCompare> std::pair<iterator, bool> insert_check - ( const KeyType &key, KeyTypeKeyCompare comp, KeyValuePrioCompare key_value_pcomp + ( const KeyType &key, KeyTypeKeyCompare comp, const PrioType &prio, PrioValuePrioCompare pcomp , insert_commit_data &commit_data) - { return tree_type::insert_unique_check(key, comp, key_value_pcomp, commit_data); } + { return tree_type::insert_unique_check(key, comp, prio, pcomp, commit_data); } - //! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,KeyValuePrioCompare,insert_commit_data&) - template<class KeyType, class KeyTypeKeyCompare, class KeyValuePrioCompare> + //! @copydoc ::boost::intrusive::treap::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,PrioValuePrioCompare,insert_commit_data&) + template<class KeyType, class KeyTypeKeyCompare, class PrioType, class PrioValuePrioCompare> std::pair<iterator, bool> insert_check - ( const_iterator hint, const KeyType &key - , KeyTypeKeyCompare comp, KeyValuePrioCompare key_value_pcomp + ( const_iterator hint + , const KeyType &key, KeyTypeKeyCompare comp + , const PrioType &prio, PrioValuePrioCompare pcomp , insert_commit_data &commit_data) - { return tree_type::insert_unique_check(hint, key, comp, key_value_pcomp, commit_data); } + { return tree_type::insert_unique_check(hint, key, comp, prio, pcomp, commit_data); } //! @copydoc ::boost::intrusive::treap::insert_unique(Iterator,Iterator) template<class Iterator> @@ -455,11 +457,11 @@ class treap_set_impl #else template<class Compare2> - void merge(treap_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + void merge(treap_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) { return tree_type::merge_unique(source); } template<class Compare2> - void merge(treap_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + void merge(treap_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) { return tree_type::merge_unique(source); } #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED @@ -473,14 +475,15 @@ template<class T, class ...Options> #else template<class T, class O1 = void, class O2 = void , class O3 = void, class O4 = void - , class O5 = void, class O6 = void> + , class O5 = void, class O6 = void + , class O7 = void> #endif struct make_treap_set { typedef typename pack_options < treap_defaults, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -493,6 +496,7 @@ struct make_treap_set < value_traits , typename packed_options::key_of_value , typename packed_options::compare + , typename packed_options::priority_of_value , typename packed_options::priority , typename packed_options::size_type , packed_options::constant_time_size @@ -505,14 +509,14 @@ struct make_treap_set #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) -template<class T, class O1, class O2, class O3, class O4, class O5, class O6> +template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7> #else template<class T, class ...Options> #endif class treap_set : public make_treap_set<T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -521,7 +525,7 @@ class treap_set typedef typename make_treap_set <T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -538,49 +542,49 @@ class treap_set //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - treap_set() + BOOST_INTRUSIVE_FORCEINLINE treap_set() : Base() {} - explicit treap_set( const key_compare &cmp + BOOST_INTRUSIVE_FORCEINLINE explicit treap_set( const key_compare &cmp , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(cmp, pcmp, v_traits) {} template<class Iterator> - treap_set( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE treap_set( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, pcmp, v_traits) {} - treap_set(BOOST_RV_REF(treap_set) x) + BOOST_INTRUSIVE_FORCEINLINE treap_set(BOOST_RV_REF(treap_set) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - treap_set& operator=(BOOST_RV_REF(treap_set) x) + BOOST_INTRUSIVE_FORCEINLINE treap_set& operator=(BOOST_RV_REF(treap_set) x) { return static_cast<treap_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const treap_set &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const treap_set &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(treap_set) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(treap_set) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static treap_set &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static treap_set &container_from_end_iterator(iterator end_iterator) { return static_cast<treap_set &>(Base::container_from_end_iterator(end_iterator)); } - static const treap_set &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const treap_set &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const treap_set &>(Base::container_from_end_iterator(end_iterator)); } - static treap_set &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static treap_set &container_from_iterator(iterator it) { return static_cast<treap_set &>(Base::container_from_iterator(it)); } - static const treap_set &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const treap_set &container_from_iterator(const_iterator it) { return static_cast<const treap_set &>(Base::container_from_iterator(it)); } }; @@ -600,15 +604,15 @@ class treap_set #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) template<class T, class ...Options> #else -template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> +template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class VoidOrPrioOfValue, class VoidOrPrioComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> #endif class treap_multiset_impl #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED - : public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> + : public treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> #endif { /// @cond - typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type; + typedef treap_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> tree_type; BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset_impl) typedef tree_type implementation_defined; @@ -627,6 +631,7 @@ class treap_multiset_impl typedef typename implementation_defined::size_type size_type; typedef typename implementation_defined::value_compare value_compare; typedef typename implementation_defined::key_compare key_compare; + typedef typename implementation_defined::priority_type priority_type; typedef typename implementation_defined::priority_compare priority_compare; typedef typename implementation_defined::iterator iterator; typedef typename implementation_defined::const_iterator const_iterator; @@ -967,11 +972,11 @@ class treap_multiset_impl #else template<class Compare2> - void merge(treap_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + void merge(treap_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) { return tree_type::merge_equal(source); } template<class Compare2> - void merge(treap_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) + void merge(treap_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, VoidOrPrioOfValue, VoidOrPrioComp, SizeType, ConstantTimeSize, HeaderHolder> &source) { return tree_type::merge_equal(source); } #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED @@ -985,14 +990,15 @@ template<class T, class ...Options> #else template<class T, class O1 = void, class O2 = void , class O3 = void, class O4 = void - , class O5 = void, class O6 = void> + , class O5 = void, class O6 = void + , class O7 = void> #endif struct make_treap_multiset { typedef typename pack_options < treap_defaults, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1005,6 +1011,7 @@ struct make_treap_multiset < value_traits , typename packed_options::key_of_value , typename packed_options::compare + , typename packed_options::priority_of_value , typename packed_options::priority , typename packed_options::size_type , packed_options::constant_time_size @@ -1017,14 +1024,14 @@ struct make_treap_multiset #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) -template<class T, class O1, class O2, class O3, class O4, class O5, class O6> +template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7> #else template<class T, class ...Options> #endif class treap_multiset : public make_treap_multiset<T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1033,7 +1040,7 @@ class treap_multiset typedef typename make_treap_multiset <T, #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) - O1, O2, O3, O4, O5, O6 + O1, O2, O3, O4, O5, O6, O7 #else Options... #endif @@ -1050,49 +1057,49 @@ class treap_multiset //Assert if passed value traits are compatible with the type BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); - treap_multiset() + BOOST_INTRUSIVE_FORCEINLINE treap_multiset() : Base() {} - explicit treap_multiset( const key_compare &cmp + BOOST_INTRUSIVE_FORCEINLINE explicit treap_multiset( const key_compare &cmp , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(cmp, pcmp, v_traits) {} template<class Iterator> - treap_multiset( Iterator b, Iterator e + BOOST_INTRUSIVE_FORCEINLINE treap_multiset( Iterator b, Iterator e , const key_compare &cmp = key_compare() , const priority_compare &pcmp = priority_compare() , const value_traits &v_traits = value_traits()) : Base(b, e, cmp, pcmp, v_traits) {} - treap_multiset(BOOST_RV_REF(treap_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE treap_multiset(BOOST_RV_REF(treap_multiset) x) : Base(BOOST_MOVE_BASE(Base, x)) {} - treap_multiset& operator=(BOOST_RV_REF(treap_multiset) x) + BOOST_INTRUSIVE_FORCEINLINE treap_multiset& operator=(BOOST_RV_REF(treap_multiset) x) { return static_cast<treap_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } template <class Cloner, class Disposer> - void clone_from(const treap_multiset &src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(const treap_multiset &src, Cloner cloner, Disposer disposer) { Base::clone_from(src, cloner, disposer); } template <class Cloner, class Disposer> - void clone_from(BOOST_RV_REF(treap_multiset) src, Cloner cloner, Disposer disposer) + BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(treap_multiset) src, Cloner cloner, Disposer disposer) { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); } - static treap_multiset &container_from_end_iterator(iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static treap_multiset &container_from_end_iterator(iterator end_iterator) { return static_cast<treap_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static const treap_multiset &container_from_end_iterator(const_iterator end_iterator) + BOOST_INTRUSIVE_FORCEINLINE static const treap_multiset &container_from_end_iterator(const_iterator end_iterator) { return static_cast<const treap_multiset &>(Base::container_from_end_iterator(end_iterator)); } - static treap_multiset &container_from_iterator(iterator it) + BOOST_INTRUSIVE_FORCEINLINE static treap_multiset &container_from_iterator(iterator it) { return static_cast<treap_multiset &>(Base::container_from_iterator(it)); } - static const treap_multiset &container_from_iterator(const_iterator it) + BOOST_INTRUSIVE_FORCEINLINE static const treap_multiset &container_from_iterator(const_iterator it) { return static_cast<const treap_multiset &>(Base::container_from_iterator(it)); } }; diff --git a/boost/intrusive/unordered_set_hook.hpp b/boost/intrusive/unordered_set_hook.hpp index f03940bdfb..54a04d373c 100644 --- a/boost/intrusive/unordered_set_hook.hpp +++ b/boost/intrusive/unordered_set_hook.hpp @@ -82,22 +82,22 @@ struct unordered_node_traits static const bool store_hash = StoreHash; static const bool optimize_multikey = OptimizeMultiKey; - static node_ptr get_next(const const_node_ptr & n) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) { return pointer_traits<node_ptr>::static_cast_from(n->next_); } - static void set_next(node_ptr n, node_ptr next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->next_ = 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->prev_in_group_; } - static void set_prev_in_group(node_ptr n, node_ptr prev) + BOOST_INTRUSIVE_FORCEINLINE static void set_prev_in_group(node_ptr n, node_ptr prev) { n->prev_in_group_ = 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->hash_; } - 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->hash_ = h; } }; @@ -127,19 +127,19 @@ struct unordered_algorithms typedef typename NodeTraits::node_ptr node_ptr; typedef typename NodeTraits::const_node_ptr const_node_ptr; - static void init(typename base_type::node_ptr n) + BOOST_INTRUSIVE_FORCEINLINE static void init(typename base_type::node_ptr n) { base_type::init(n); group_algorithms::init(n); } - static void init_header(typename base_type::node_ptr n) + BOOST_INTRUSIVE_FORCEINLINE static void init_header(typename base_type::node_ptr n) { base_type::init_header(n); group_algorithms::init_header(n); } - static void unlink(typename base_type::node_ptr n) + BOOST_INTRUSIVE_FORCEINLINE static void unlink(typename base_type::node_ptr n) { base_type::unlink(n); group_algorithms::unlink(n); |