From fa3a6af325a18a547468cf4dd5425d2ef315880a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 15 Sep 2018 00:58:21 +0200 Subject: [PATCH 1/4] Add BOOST_INTRUSIVE_FORCEINLINE to unordered_multiset constructors --- include/boost/intrusive/unordered_set.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/intrusive/unordered_set.hpp b/include/boost/intrusive/unordered_set.hpp index cf60dc4..5588cb1 100644 --- a/include/boost/intrusive/unordered_set.hpp +++ b/include/boost/intrusive/unordered_set.hpp @@ -498,6 +498,7 @@ class unordered_set typedef typename Base::hasher hasher; typedef typename Base::key_equal key_equal; + BOOST_INTRUSIVE_FORCEINLINE explicit unordered_set ( const bucket_traits &b_traits , const hasher & hash_func = hasher() , const key_equal &equal_func = key_equal() @@ -506,7 +507,8 @@ class unordered_set {} template - BOOST_INTRUSIVE_FORCEINLINE unordered_set + BOOST_INTRUSIVE_FORCEINLINE + unordered_set ( Iterator b, Iterator e , const bucket_traits &b_traits , const hasher & hash_func = hasher() @@ -947,6 +949,7 @@ class unordered_multiset typedef typename Base::hasher hasher; typedef typename Base::key_equal key_equal; + BOOST_INTRUSIVE_FORCEINLINE explicit unordered_multiset( const bucket_traits &b_traits , const hasher & hash_func = hasher() , const key_equal &equal_func = key_equal() @@ -954,7 +957,8 @@ class unordered_multiset : Base(b_traits, hash_func, equal_func, v_traits) {} - template BOOST_INTRUSIVE_FORCEINLINE + template + BOOST_INTRUSIVE_FORCEINLINE unordered_multiset( Iterator b , Iterator e , const bucket_traits &b_traits From d94fbc76cc1e146b2a7ab09070f1ce1a86983de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 15 Sep 2018 00:58:43 +0200 Subject: [PATCH 2/4] Add customized return type for tree_value_compare --- .../intrusive/detail/tree_value_compare.hpp | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/include/boost/intrusive/detail/tree_value_compare.hpp b/include/boost/intrusive/detail/tree_value_compare.hpp index f6dd01d..c78da0a 100644 --- a/include/boost/intrusive/detail/tree_value_compare.hpp +++ b/include/boost/intrusive/detail/tree_value_compare.hpp @@ -45,7 +45,7 @@ struct disable_if_smartref_to //This function object takes a KeyCompare function object //and compares values that contains keys using KeyOfValue -template< class ValuePtr, class KeyCompare, class KeyOfValue +template< class ValuePtr, class KeyCompare, class KeyOfValue, class Ret = bool , bool = boost::intrusive::detail::is_same ::type, typename KeyOfValue::type>::value > struct tree_value_compare @@ -80,41 +80,52 @@ struct tree_value_compare BOOST_INTRUSIVE_FORCEINLINE const key_compare &key_comp() const { return static_cast(*this); } - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const key_type &key1, const key_type &key2) const + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key) const + { return this->key_comp()(key); } + + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const value_type &value) const + { return this->key_comp()(KeyOfValue()(value)); } + + template + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey + , typename disable_if_smartref_to::type* = 0) const + { return this->key_comp()(nonkey); } + + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key1, const key_type &key2) const { return this->key_comp()(key1, key2); } - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const value_type &value1, const value_type &value2) const + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const value_type &value1, const value_type &value2) const { return this->key_comp()(KeyOfValue()(value1), KeyOfValue()(value2)); } - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const key_type &key1, const value_type &value2) const + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key1, const value_type &value2) const { return this->key_comp()(key1, KeyOfValue()(value2)); } - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const value_type &value1, const key_type &key2) const + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const value_type &value1, const key_type &key2) const { return this->key_comp()(KeyOfValue()(value1), key2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()( const key_type &key1, const U &nonkey2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const key_type &key1, const U &nonkey2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(key1, nonkey2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()( const U &nonkey1, const key_type &key2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey1, const key_type &key2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(nonkey1, key2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()( const value_type &value1, const U &nonvalue2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const value_type &value1, const U &nonvalue2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(KeyOfValue()(value1), nonvalue2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()( const U &nonvalue1, const value_type &value2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonvalue1, const value_type &value2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(nonvalue1, KeyOfValue()(value2)); } }; -template -struct tree_value_compare +template +struct tree_value_compare : public boost::intrusive::detail::ebo_functor_holder { typedef typename @@ -147,16 +158,24 @@ struct tree_value_compare BOOST_INTRUSIVE_FORCEINLINE const key_compare &key_comp() const { return static_cast(*this); } - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const key_type &key1, const key_type &key2) const + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key) const + { return this->key_comp()(key); } + + template + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const U &nonkey + , typename disable_if_smartref_to::type* = 0) const + { return this->key_comp()(nonkey); } + + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const key_type &key1, const key_type &key2) const { return this->key_comp()(key1, key2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()( const key_type &key1, const U &nonkey2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()( const key_type &key1, const U &nonkey2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(key1, nonkey2); } template - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2 + BOOST_INTRUSIVE_FORCEINLINE Ret operator()(const U &nonkey1, const key_type &key2 , typename disable_if_smartref_to::type* = 0) const { return this->key_comp()(nonkey1, key2); } }; From 99326f50fbc4fec0f5a23afc6606dd9d654e8dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 18 Sep 2018 14:26:31 +0200 Subject: [PATCH 3/4] Fix clang 6.0 warnings in tests: unused members, suspicious return types --- example/doc_advanced_value_traits.cpp | 2 +- example/doc_any_hook.cpp | 3 +++ example/doc_derivation_value_traits.cpp | 2 +- example/doc_how_to_use.cpp | 3 +++ example/doc_list.cpp | 3 +++ example/doc_member_value_traits.cpp | 2 +- example/doc_offset_ptr.cpp | 2 +- example/doc_slist.cpp | 3 +++ test/virtual_base_test.cpp | 4 ++++ 9 files changed, 20 insertions(+), 4 deletions(-) diff --git a/example/doc_advanced_value_traits.cpp b/example/doc_advanced_value_traits.cpp index a295901..dc5f8d2 100644 --- a/example/doc_advanced_value_traits.cpp +++ b/example/doc_advanced_value_traits.cpp @@ -98,7 +98,7 @@ int main() //Test the objects inserted in our lists for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ - if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; + if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1; } return 0; } diff --git a/example/doc_any_hook.cpp b/example/doc_any_hook.cpp index 03bd0d2..2526f70 100644 --- a/example/doc_any_hook.cpp +++ b/example/doc_any_hook.cpp @@ -26,6 +26,9 @@ class MyClass : public any_base_hook<> //Base hook MyClass(int i = 0) : int_(i) {} + //<- + int get_int() const { return int_; } + //-> }; int main() diff --git a/example/doc_derivation_value_traits.cpp b/example/doc_derivation_value_traits.cpp index e900657..c760bb8 100644 --- a/example/doc_derivation_value_traits.cpp +++ b/example/doc_derivation_value_traits.cpp @@ -87,7 +87,7 @@ int main() //Test the objects inserted in our lists for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ - if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; + if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1; } return 0; } diff --git a/example/doc_how_to_use.cpp b/example/doc_how_to_use.cpp index 05d9887..22ea3fd 100644 --- a/example/doc_how_to_use.cpp +++ b/example/doc_how_to_use.cpp @@ -23,6 +23,9 @@ class MyClass : public list_base_hook<> list_member_hook<> member_hook_; MyClass(int i) : int_(i) {} + //<- + int get_int() const { return int_; } + //-> }; //Define a list that will store MyClass using the base hook diff --git a/example/doc_list.cpp b/example/doc_list.cpp index 7b6f390..ec5693a 100644 --- a/example/doc_list.cpp +++ b/example/doc_list.cpp @@ -26,6 +26,9 @@ class MyClass : public list_base_hook<> //This is a derivation hook MyClass(int i) : int_(i) {} + //<- + int get_int() const { return int_; } + //-> }; //Define a list that will store MyClass using the public base hook diff --git a/example/doc_member_value_traits.cpp b/example/doc_member_value_traits.cpp index 45d1f1d..37886dd 100644 --- a/example/doc_member_value_traits.cpp +++ b/example/doc_member_value_traits.cpp @@ -88,7 +88,7 @@ int main() //Test the objects inserted in our lists for(; it1 != itend1; ++it1, ++bit1, ++it2, ++bit2){ - if(&*bit1 != &*it1 || &*bit2 != &*it2) return false; + if(&*bit1 != &*it1 || &*bit2 != &*it2) return 1; } return 0; } diff --git a/example/doc_offset_ptr.cpp b/example/doc_offset_ptr.cpp index 2e1906f..f285ac7 100644 --- a/example/doc_offset_ptr.cpp +++ b/example/doc_offset_ptr.cpp @@ -100,7 +100,7 @@ int main() int checker = 0; for( intrusive_list_t::const_iterator it = plist->begin(), itend(plist->end()) ; it != itend; ++it, ++checker){ - if(it->get() != checker) return false; + if(it->get() != checker) return 1; } //Now delete the list and after that, the nodes diff --git a/example/doc_slist.cpp b/example/doc_slist.cpp index c513177..eda8f85 100644 --- a/example/doc_slist.cpp +++ b/example/doc_slist.cpp @@ -27,6 +27,9 @@ class MyClass : public slist_base_hook<> MyClass(int i) : int_(i) {} + //<- + int get_int() const { return int_; } + //-> }; //Define an slist that will store MyClass using the public base hook diff --git a/test/virtual_base_test.cpp b/test/virtual_base_test.cpp index b673c1a..70a59db 100644 --- a/test/virtual_base_test.cpp +++ b/test/virtual_base_test.cpp @@ -44,11 +44,15 @@ class MyClass , public virtual VirtualBase3 { int int_; + public: list_member_hook<> list_hook_; MyClass(int i = 0) : int_(i) {} + //<- + int get_int() const { return int_; } + //-> }; //Define a list that will store MyClass using the public base hook From 2ab3421b17009adac5b1f7a688b7962cf4709495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 27 Sep 2018 10:14:16 +0200 Subject: [PATCH 4/4] In functions that modify data structures, take pointers by value instead of by reference, to avoid aliasing issues. --- .../boost/intrusive/avltree_algorithms.hpp | 88 ++++++------ include/boost/intrusive/bstree_algorithms.hpp | 78 +++++------ .../intrusive/circular_list_algorithms.hpp | 30 ++-- .../intrusive/circular_slist_algorithms.hpp | 14 +- .../intrusive/derivation_value_traits.hpp | 2 +- .../detail/any_node_and_algorithms.hpp | 28 ++-- .../boost/intrusive/detail/avltree_node.hpp | 18 +-- .../detail/common_slist_algorithms.hpp | 14 +- .../boost/intrusive/detail/list_iterator.hpp | 2 +- include/boost/intrusive/detail/list_node.hpp | 4 +- .../intrusive/detail/node_cloner_disposer.hpp | 4 +- .../boost/intrusive/detail/rbtree_node.hpp | 12 +- .../intrusive/detail/simple_disposers.hpp | 2 +- .../boost/intrusive/detail/slist_iterator.hpp | 2 +- include/boost/intrusive/detail/slist_node.hpp | 2 +- .../boost/intrusive/detail/tree_iterator.hpp | 2 +- include/boost/intrusive/detail/tree_node.hpp | 6 +- include/boost/intrusive/hashtable.hpp | 24 ++-- .../intrusive/linear_slist_algorithms.hpp | 8 +- include/boost/intrusive/rbtree_algorithms.hpp | 78 +++++------ include/boost/intrusive/sgtree_algorithms.hpp | 122 ++++++++-------- include/boost/intrusive/slist.hpp | 8 +- .../boost/intrusive/splaytree_algorithms.hpp | 132 +++++++++--------- include/boost/intrusive/treap_algorithms.hpp | 108 +++++++------- .../boost/intrusive/unordered_set_hook.hpp | 6 +- perf/perf_list.cpp | 2 +- test/virtual_base_test.cpp | 11 +- 27 files changed, 408 insertions(+), 399 deletions(-) diff --git a/include/boost/intrusive/avltree_algorithms.hpp b/include/boost/intrusive/avltree_algorithms.hpp index 1459851..1d206cd 100644 --- a/include/boost/intrusive/avltree_algorithms.hpp +++ b/include/boost/intrusive/avltree_algorithms.hpp @@ -42,18 +42,18 @@ struct avltree_node_cloner typedef typename NodeTraits::node_ptr node_ptr; typedef detail::ebo_functor_holder base_t; - avltree_node_cloner(F f) + BOOST_INTRUSIVE_FORCEINLINE avltree_node_cloner(F f) : base_t(f) {} - node_ptr operator()(const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(const node_ptr & p) { node_ptr n = base_t::get()(p); NodeTraits::set_balance(n, NodeTraits::get_balance(p)); return n; } - node_ptr operator()(const node_ptr & p) const + BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(const node_ptr & p) const { node_ptr n = base_t::get()(p); NodeTraits::set_balance(n, NodeTraits::get_balance(p)); @@ -176,12 +176,12 @@ class avltree_algorithms static node_ptr end_node(const const_node_ptr & header); //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree - static void swap_tree(const node_ptr & header1, const node_ptr & header2); + static void swap_tree(node_ptr header1, node_ptr header2); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & node2) + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr node2) { if(node1 == node2) return; @@ -190,8 +190,8 @@ class avltree_algorithms swap_nodes(node1, header1, node2, header2); } - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2) + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr,node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) { if(node1 == node2) return; @@ -202,23 +202,23 @@ class avltree_algorithms NodeTraits::set_balance(node2, c); } - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) { if(node_to_be_replaced == new_node) return; replace_node(node_to_be_replaced, bstree_algo::get_header(node_to_be_replaced), new_node); } - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) { bstree_algo::replace_node(node_to_be_replaced, header, new_node); NodeTraits::set_balance(new_node, NodeTraits::get_balance(node_to_be_replaced)); } - //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&) - static void unlink(const node_ptr & node) + //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) + static void unlink(node_ptr node) { node_ptr x = NodeTraits::get_parent(node); if(x){ @@ -244,7 +244,7 @@ class avltree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&) static node_ptr prev_node(const node_ptr & node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) static void init(const node_ptr & node); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED @@ -258,14 +258,14 @@ class avltree_algorithms //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. - static void init_header(const node_ptr & header) + static void init_header(node_ptr header) { bstree_algo::init_header(header); NodeTraits::set_balance(header, NodeTraits::zero()); } - //! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&) - static node_ptr erase(const node_ptr & header, const node_ptr & z) + //! @copydoc ::boost::intrusive::bstree_algorithms::erase(node_ptr,node_ptr) + static node_ptr erase(node_ptr header, node_ptr z) { typename bstree_algo::data_for_rebalance info; bstree_algo::erase(header, z, info); @@ -276,7 +276,7 @@ class avltree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique template static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { typename bstree_algo::data_for_rebalance info; bool const transferred = bstree_algo::transfer_unique(header1, comp, header2, z, info); @@ -290,7 +290,7 @@ class avltree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal template static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { typename bstree_algo::data_for_rebalance info; bstree_algo::transfer_equal(header1, comp, header2, z, info); @@ -298,10 +298,10 @@ class avltree_algorithms rebalance_after_insertion(header1, z); } - //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer) + //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,node_ptr,Cloner,Disposer) template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer) + (const const_node_ptr & source_header, node_ptr target_header, Cloner cloner, Disposer disposer) { avltree_node_cloner new_cloner(cloner); bstree_algo::clone(source_header, target_header, new_cloner, disposer); @@ -344,54 +344,54 @@ class avltree_algorithms #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_upper_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal_upper_bound(h, new_node, comp); rebalance_after_insertion(h, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_lower_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal_lower_bound(h, new_node, comp); rebalance_after_insertion(h, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(node_ptr,node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal - (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal(header, hint, new_node, comp); rebalance_after_insertion(header, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(node_ptr,node_ptr,node_ptr) static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node) + (node_ptr header, node_ptr pos, node_ptr new_node) { bstree_algo::insert_before(header, pos, new_node); rebalance_after_insertion(header, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&) - static void push_back(const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(node_ptr,node_ptr) + static void push_back(node_ptr header, node_ptr new_node) { bstree_algo::push_back(header, new_node); rebalance_after_insertion(header, new_node); } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&) - static void push_front(const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(node_ptr,node_ptr) + static void push_front(node_ptr header, node_ptr new_node) { bstree_algo::push_front(header, new_node); rebalance_after_insertion(header, new_node); @@ -411,9 +411,9 @@ class avltree_algorithms ,KeyNodePtrCompare comp, insert_commit_data &commit_data); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data &) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(node_ptr,node_ptr,const insert_commit_data &) static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data) + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) { bstree_algo::insert_unique_commit(header, new_value, commit_data); rebalance_after_insertion(header, new_value); @@ -483,7 +483,7 @@ class avltree_algorithms } static void rebalance_after_erasure - ( const node_ptr & header, const node_ptr &z, const typename bstree_algo::data_for_rebalance &info) + ( node_ptr header, node_ptr z, const typename bstree_algo::data_for_rebalance &info) { if(info.y != z){ NodeTraits::set_balance(info.y, NodeTraits::get_balance(z)); @@ -492,7 +492,7 @@ class avltree_algorithms rebalance_after_erasure_restore_invariants(header, info.x, info.x_parent); } - static void rebalance_after_erasure_restore_invariants(const node_ptr & header, node_ptr x, node_ptr x_parent) + static void rebalance_after_erasure_restore_invariants(node_ptr header, node_ptr x, node_ptr x_parent) { for ( node_ptr root = NodeTraits::get_parent(header) ; x != root @@ -560,7 +560,7 @@ class avltree_algorithms } } - static void rebalance_after_insertion(const node_ptr & header, node_ptr x) + static void rebalance_after_insertion(node_ptr header, node_ptr x) { NodeTraits::set_balance(x, NodeTraits::zero()); // Rebalance. @@ -605,7 +605,7 @@ class avltree_algorithms } } - static void left_right_balancing(const node_ptr & a, const node_ptr & b, const node_ptr & c) + static void left_right_balancing(node_ptr a, node_ptr b, node_ptr c) { // balancing... const balance c_balance = NodeTraits::get_balance(c); @@ -630,7 +630,7 @@ class avltree_algorithms } } - static node_ptr avl_rotate_left_right(const node_ptr a, const node_ptr a_oldleft, const node_ptr & hdr) + static node_ptr avl_rotate_left_right(const node_ptr a, const node_ptr a_oldleft, node_ptr hdr) { // [note: 'a_oldleft' is 'b'] // | | // // a(-2) c // @@ -650,7 +650,7 @@ class avltree_algorithms return c; } - static node_ptr avl_rotate_right_left(const node_ptr a, const node_ptr a_oldright, const node_ptr & hdr) + static node_ptr avl_rotate_right_left(const node_ptr a, const node_ptr a_oldright, node_ptr hdr) { // [note: 'a_oldright' is 'b'] // | | // // a(pos) c // @@ -670,7 +670,7 @@ class avltree_algorithms return c; } - static void avl_rotate_left(const node_ptr &x, const node_ptr &x_oldright, const node_ptr & hdr) + static void avl_rotate_left(node_ptr x, node_ptr x_oldright, node_ptr hdr) { bstree_algo::rotate_left(x, x_oldright, NodeTraits::get_parent(x), hdr); @@ -685,7 +685,7 @@ class avltree_algorithms } } - static void avl_rotate_right(const node_ptr &x, const node_ptr &x_oldleft, const node_ptr & hdr) + static void avl_rotate_right(node_ptr x, node_ptr x_oldleft, node_ptr hdr) { bstree_algo::rotate_right(x, x_oldleft, NodeTraits::get_parent(x), hdr); diff --git a/include/boost/intrusive/bstree_algorithms.hpp b/include/boost/intrusive/bstree_algorithms.hpp index e449eba..006d9c2 100644 --- a/include/boost/intrusive/bstree_algorithms.hpp +++ b/include/boost/intrusive/bstree_algorithms.hpp @@ -277,7 +277,7 @@ class bstree_algorithms : public bstree_algorithms_base //! node1 and node2 are not equivalent according to the ordering rules. //! //!Experimental function - static void swap_nodes(const node_ptr & node1, const node_ptr & node2) + static void swap_nodes(node_ptr node1, node_ptr node2) { if(node1 == node2) return; @@ -301,7 +301,7 @@ class bstree_algorithms : public bstree_algorithms_base //! node1 and node2 are not equivalent according to the ordering rules. //! //!Experimental function - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) { if(node1 == node2) return; @@ -448,7 +448,7 @@ class bstree_algorithms : public bstree_algorithms_base //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting //! the node, since no rebalancing and comparison is needed. Experimental function - BOOST_INTRUSIVE_FORCEINLINE static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node) + BOOST_INTRUSIVE_FORCEINLINE static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) { if(node_to_be_replaced == new_node) return; @@ -469,7 +469,7 @@ class bstree_algorithms : public bstree_algorithms_base //! new_node is not equivalent to node_to_be_replaced according to the //! ordering rules. This function is faster than erasing and inserting //! the node, since no rebalancing or comparison is needed. Experimental function - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) { if(node_to_be_replaced == new_node) return; @@ -559,7 +559,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. - BOOST_INTRUSIVE_FORCEINLINE static void init(const node_ptr & node) + BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr node) { NodeTraits::set_parent(node, node_ptr()); NodeTraits::set_left(node, node_ptr()); @@ -588,7 +588,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. - BOOST_INTRUSIVE_FORCEINLINE static void init_header(const node_ptr & header) + BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr header) { NodeTraits::set_parent(header, node_ptr()); NodeTraits::set_left(header, header); @@ -629,7 +629,7 @@ class bstree_algorithms : public bstree_algorithms_base //! only be used for more unlink_leftmost_without_rebalance calls. //! This function is normally used to achieve a step by step //! controlled destruction of the tree. - static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header) + static node_ptr unlink_leftmost_without_rebalance(node_ptr header) { node_ptr leftmost = NodeTraits::get_left(header); if (leftmost == header) @@ -684,7 +684,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Constant. //! //! Throws: Nothing. - static void swap_tree(const node_ptr & header1, const node_ptr & header2) + static void swap_tree(node_ptr header1, node_ptr header2) { if(header1 == header2) return; @@ -956,7 +956,7 @@ class bstree_algorithms : public bstree_algorithms_base //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. BOOST_INTRUSIVE_FORCEINLINE static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data) + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) { return insert_commit(header, new_value, commit_data); } //! Requires: "header" must be the header node of a tree. @@ -1112,7 +1112,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If "comp" throws. template static node_ptr insert_equal - (const node_ptr & h, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp + (node_ptr h, node_ptr hint, node_ptr new_node, NodePtrCompare comp #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1138,7 +1138,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If "comp" throws. template static node_ptr insert_equal_upper_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp + (node_ptr h, node_ptr new_node, NodePtrCompare comp #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1164,7 +1164,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If "comp" throws. template static node_ptr insert_equal_lower_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp + (node_ptr h, node_ptr new_node, NodePtrCompare comp #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1191,7 +1191,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Note: If "pos" is not the successor of the newly inserted "new_node" //! tree invariants might be broken. static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node + (node_ptr header, node_ptr pos, node_ptr new_node #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1217,7 +1217,7 @@ class bstree_algorithms : public bstree_algorithms_base //! tree invariants are broken. This function is slightly faster than //! using "insert_before". static void push_back - (const node_ptr & header, const node_ptr & new_node + (node_ptr header, node_ptr new_node #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1242,7 +1242,7 @@ class bstree_algorithms : public bstree_algorithms_base //! tree invariants are broken. This function is slightly faster than //! using "insert_before". static void push_front - (const node_ptr & header, const node_ptr & new_node + (node_ptr header, node_ptr new_node #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1292,7 +1292,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If cloner functor throws. If this happens target nodes are disposed. template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer) + (const const_node_ptr & source_header, node_ptr target_header, Cloner cloner, Disposer disposer) { if(!unique(target_header)){ clear_and_dispose(target_header, disposer); @@ -1316,7 +1316,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Amortized constant time. //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void erase(const node_ptr & header, const node_ptr & z) + BOOST_INTRUSIVE_FORCEINLINE static void erase(node_ptr header, node_ptr z) { data_for_rebalance ignored; erase(header, z, ignored); @@ -1336,7 +1336,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If the comparison throws. template BOOST_INTRUSIVE_FORCEINLINE static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { data_for_rebalance ignored; return transfer_unique(header1, comp, header2, z, ignored); @@ -1353,7 +1353,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: If the comparison throws. template BOOST_INTRUSIVE_FORCEINLINE static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { data_for_rebalance ignored; transfer_equal(header1, comp, header2, z, ignored); @@ -1366,7 +1366,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Average complexity is constant time. //! //! Throws: Nothing. - static void unlink(const node_ptr & node) + static void unlink(node_ptr node) { node_ptr x = NodeTraits::get_parent(node); if(x){ @@ -1383,7 +1383,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: Nothing. //! //! Complexity: Linear. - static void rebalance(const node_ptr & header) + static void rebalance(node_ptr header) { node_ptr root = NodeTraits::get_parent(header); if(root){ @@ -1400,7 +1400,7 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: Nothing. //! //! Complexity: Linear. - static node_ptr rebalance_subtree(const node_ptr & old_root) + static node_ptr rebalance_subtree(node_ptr old_root) { //Taken from: //"Tree rebalancing in optimal time and space" @@ -1476,7 +1476,7 @@ class bstree_algorithms : public bstree_algorithms_base template static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z, data_for_rebalance &info) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z, data_for_rebalance &info) { insert_commit_data commit_data; bool const transferable = insert_unique_check(header1, z, comp, commit_data).second; @@ -1489,7 +1489,7 @@ class bstree_algorithms : public bstree_algorithms_base template static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z, data_for_rebalance &info) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z, data_for_rebalance &info) { insert_commit_data commit_data; insert_equal_upper_bound_check(header1, z, comp, commit_data); @@ -1497,7 +1497,7 @@ class bstree_algorithms : public bstree_algorithms_base insert_commit(header1, z, commit_data); } - static void erase(const node_ptr & header, const node_ptr & z, data_for_rebalance &info) + static void erase(node_ptr header, node_ptr z, data_for_rebalance &info) { node_ptr y(z); node_ptr x; @@ -1643,7 +1643,7 @@ class bstree_algorithms : public bstree_algorithms_base { return NodeTraits::get_right(NodeTraits::get_parent(p)) == p; } static void insert_before_check - (const node_ptr &header, const node_ptr & pos + (node_ptr header, node_ptr pos , insert_commit_data &commit_data #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 @@ -1662,7 +1662,7 @@ class bstree_algorithms : public bstree_algorithms_base } static void push_back_check - (const node_ptr & header, insert_commit_data &commit_data + (node_ptr header, insert_commit_data &commit_data #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1677,7 +1677,7 @@ class bstree_algorithms : public bstree_algorithms_base } static void push_front_check - (const node_ptr & header, insert_commit_data &commit_data + (node_ptr header, insert_commit_data &commit_data #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED , std::size_t *pdepth = 0 #endif @@ -1693,7 +1693,7 @@ class bstree_algorithms : public bstree_algorithms_base template static void insert_equal_check - (const node_ptr &header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp , insert_commit_data &commit_data /// @cond , std::size_t *pdepth = 0 @@ -1722,7 +1722,7 @@ class bstree_algorithms : public bstree_algorithms_base template static void insert_equal_upper_bound_check - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0) + (node_ptr h, node_ptr new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0) { std::size_t depth = 0; node_ptr y(h); @@ -1741,7 +1741,7 @@ class bstree_algorithms : public bstree_algorithms_base template static void insert_equal_lower_bound_check - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0) + (node_ptr h, node_ptr new_node, NodePtrCompare comp, insert_commit_data & commit_data, std::size_t *pdepth = 0) { std::size_t depth = 0; node_ptr y(h); @@ -1759,7 +1759,7 @@ class bstree_algorithms : public bstree_algorithms_base } static void insert_commit - (const node_ptr & header, const node_ptr & new_node, const insert_commit_data &commit_data) + (node_ptr header, node_ptr new_node, const insert_commit_data &commit_data) { //Check if commit_data has not been initialized by a insert_unique_check call. BOOST_INTRUSIVE_INVARIANT_ASSERT(commit_data.node != node_ptr()); @@ -1785,7 +1785,7 @@ class bstree_algorithms : public bstree_algorithms_base } //Fix header and own's parent data when replacing x with own, providing own's old data with parent - static void set_child(const node_ptr & header, const node_ptr & new_child, const node_ptr & new_parent, const bool link_left) + static void set_child(node_ptr header, node_ptr new_child, node_ptr new_parent, const bool link_left) { if(new_parent == header) NodeTraits::set_parent(header, new_child); @@ -1796,7 +1796,7 @@ class bstree_algorithms : public bstree_algorithms_base } // rotate p to left (no header and p's parent fixup) - static void rotate_left_no_parent_fix(const node_ptr & p, const node_ptr &p_right) + static void rotate_left_no_parent_fix(node_ptr p, node_ptr p_right) { node_ptr p_right_left(NodeTraits::get_left(p_right)); NodeTraits::set_right(p, p_right_left); @@ -1808,7 +1808,7 @@ class bstree_algorithms : public bstree_algorithms_base } // rotate p to left (with header and p's parent fixup) - static void rotate_left(const node_ptr & p, const node_ptr & p_right, const node_ptr & p_parent, const node_ptr & header) + static void rotate_left(node_ptr p, node_ptr p_right, node_ptr p_parent, node_ptr header) { const bool p_was_left(NodeTraits::get_left(p_parent) == p); rotate_left_no_parent_fix(p, p_right); @@ -1817,7 +1817,7 @@ class bstree_algorithms : public bstree_algorithms_base } // rotate p to right (no header and p's parent fixup) - static void rotate_right_no_parent_fix(const node_ptr & p, const node_ptr &p_left) + static void rotate_right_no_parent_fix(node_ptr p, node_ptr p_left) { node_ptr p_left_right(NodeTraits::get_right(p_left)); NodeTraits::set_left(p, p_left_right); @@ -1829,7 +1829,7 @@ class bstree_algorithms : public bstree_algorithms_base } // rotate p to right (with header and p's parent fixup) - static void rotate_right(const node_ptr & p, const node_ptr & p_left, const node_ptr & p_parent, const node_ptr & header) + static void rotate_right(node_ptr p, node_ptr p_left, node_ptr p_parent, node_ptr header) { const bool p_was_left(NodeTraits::get_left(p_parent) == p); rotate_right_no_parent_fix(p, p_left); @@ -1883,7 +1883,7 @@ class bstree_algorithms : public bstree_algorithms_base } } - static void vine_to_subtree(const node_ptr & super_root, std::size_t count) + static void vine_to_subtree(node_ptr super_root, std::size_t count) { const std::size_t one_szt = 1u; std::size_t leaf_nodes = count + one_szt - std::size_t(one_szt << detail::floor_log2(count + one_szt)); @@ -1927,7 +1927,7 @@ class bstree_algorithms : public bstree_algorithms_base template static node_ptr clone_subtree - (const const_node_ptr &source_parent, const node_ptr &target_parent + (const const_node_ptr &source_parent, node_ptr target_parent , Cloner cloner, Disposer disposer , node_ptr &leftmost_out, node_ptr &rightmost_out ) diff --git a/include/boost/intrusive/circular_list_algorithms.hpp b/include/boost/intrusive/circular_list_algorithms.hpp index 0bc4d9d..e5d4175 100644 --- a/include/boost/intrusive/circular_list_algorithms.hpp +++ b/include/boost/intrusive/circular_list_algorithms.hpp @@ -67,7 +67,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void init(const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr this_node) { const node_ptr null_node = node_ptr(); NodeTraits::set_next(this_node, null_node); @@ -91,7 +91,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void init_header(const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr this_node) { NodeTraits::set_next(this_node, this_node); NodeTraits::set_previous(this_node, this_node); @@ -138,7 +138,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static node_ptr unlink(const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr unlink(node_ptr this_node) { node_ptr next(NodeTraits::get_next(this_node)); node_ptr prev(NodeTraits::get_previous(this_node)); @@ -154,7 +154,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void unlink(const node_ptr &b, const node_ptr &e) + BOOST_INTRUSIVE_FORCEINLINE static void unlink(node_ptr b, node_ptr e) { if (b != e) { node_ptr prevb(NodeTraits::get_previous(b)); @@ -170,7 +170,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void link_before(const node_ptr &nxt_node, const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static void link_before(node_ptr nxt_node, node_ptr this_node) { node_ptr prev(NodeTraits::get_previous(nxt_node)); NodeTraits::set_previous(this_node, prev); @@ -189,7 +189,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void link_after(const node_ptr &prev_node, const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static void link_after(node_ptr prev_node, node_ptr this_node) { node_ptr next(NodeTraits::get_next(prev_node)); NodeTraits::set_previous(this_node, prev_node); @@ -211,7 +211,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - static void swap_nodes(const node_ptr &this_node, const node_ptr &other_node) + static void swap_nodes(node_ptr this_node, node_ptr other_node) { if (other_node == this_node) return; @@ -252,7 +252,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - static void transfer(const node_ptr &p, const node_ptr &b, const node_ptr &e) + static void transfer(node_ptr p, node_ptr b, node_ptr e) { if (b != e) { node_ptr prev_p(NodeTraits::get_previous(p)); @@ -277,7 +277,7 @@ class circular_list_algorithms //! Complexity: Constant //! //! Throws: Nothing. - static void transfer(const node_ptr &p, const node_ptr &i) + static void transfer(node_ptr p, node_ptr i) { node_ptr n(NodeTraits::get_next(i)); if(n != p && i != p){ @@ -298,7 +298,7 @@ class circular_list_algorithms //! Throws: Nothing. //! //! Complexity: This function is linear time. - static void reverse(const node_ptr &p) + static void reverse(node_ptr p) { node_ptr f(NodeTraits::get_next(p)); node_ptr i(NodeTraits::get_next(f)), e(p); @@ -316,7 +316,7 @@ class circular_list_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of moved positions. - static void move_backwards(const node_ptr &p, std::size_t n) + static void move_backwards(node_ptr p, std::size_t n) { //Null shift, nothing to do if(!n) return; @@ -336,7 +336,7 @@ class circular_list_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of moved positions. - static void move_forward(const node_ptr &p, std::size_t n) + static void move_forward(node_ptr p, std::size_t n) { //Null shift, nothing to do if(!n) return; @@ -378,7 +378,7 @@ class circular_list_algorithms }; template - static void stable_partition(node_ptr beg, const node_ptr &end, Pred pred, stable_partition_info &info) + static void stable_partition(node_ptr beg, node_ptr end, Pred pred, stable_partition_info &info) { node_ptr bcur = node_traits::get_previous(beg); node_ptr cur = beg; @@ -435,14 +435,14 @@ class circular_list_algorithms } private: - BOOST_INTRUSIVE_FORCEINLINE static void swap_prev(const node_ptr &this_node, const node_ptr &other_node) + BOOST_INTRUSIVE_FORCEINLINE static void swap_prev(node_ptr this_node, node_ptr other_node) { node_ptr temp(NodeTraits::get_previous(this_node)); NodeTraits::set_previous(this_node, NodeTraits::get_previous(other_node)); NodeTraits::set_previous(other_node, temp); } - BOOST_INTRUSIVE_FORCEINLINE static void swap_next(const node_ptr &this_node, const node_ptr &other_node) + BOOST_INTRUSIVE_FORCEINLINE static void swap_next(node_ptr this_node, node_ptr other_node) { node_ptr temp(NodeTraits::get_next(this_node)); NodeTraits::set_next(this_node, NodeTraits::get_next(other_node)); diff --git a/include/boost/intrusive/circular_slist_algorithms.hpp b/include/boost/intrusive/circular_slist_algorithms.hpp index da840ef..bc5b481 100644 --- a/include/boost/intrusive/circular_slist_algorithms.hpp +++ b/include/boost/intrusive/circular_slist_algorithms.hpp @@ -141,7 +141,7 @@ class circular_slist_algorithms //! Complexity: Constant //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void init_header(const node_ptr &this_node) + BOOST_INTRUSIVE_FORCEINLINE static void init_header(node_ptr this_node) { NodeTraits::set_next(this_node, this_node); } //! Requires: this_node and prev_init_node must be in the same circular list. @@ -223,7 +223,7 @@ class circular_slist_algorithms //! Complexity: Linear to the number of elements in the circular list //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void unlink(const node_ptr & this_node) + BOOST_INTRUSIVE_FORCEINLINE static void unlink(node_ptr this_node) { if(NodeTraits::get_next(this_node)) base_t::unlink_after(get_previous_node(this_node)); @@ -236,7 +236,7 @@ class circular_slist_algorithms //! Complexity: Linear to the number of elements in the circular list. //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static void link_before (const node_ptr & nxt_node, const node_ptr & this_node) + BOOST_INTRUSIVE_FORCEINLINE static void link_before (node_ptr nxt_node, node_ptr this_node) { base_t::link_after(get_previous_node(nxt_node), this_node); } //! Requires: this_node and other_node must be nodes inserted @@ -249,7 +249,7 @@ class circular_slist_algorithms //! Complexity: Linear to number of elements of both lists //! //! Throws: Nothing. - static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node) + static void swap_nodes(node_ptr this_node, node_ptr other_node) { if (other_node == this_node) return; @@ -275,7 +275,7 @@ class circular_slist_algorithms //! Throws: Nothing. //! //! Complexity: This function is linear to the contained elements. - static void reverse(const node_ptr & p) + static void reverse(node_ptr p) { node_ptr i = NodeTraits::get_next(p), e(p); for (;;) { @@ -294,7 +294,7 @@ class circular_slist_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of elements plus the number moved positions. - static node_ptr move_backwards(const node_ptr & p, std::size_t n) + static node_ptr move_backwards(node_ptr p, std::size_t n) { //Null shift, nothing to do if(!n) return node_ptr(); @@ -346,7 +346,7 @@ class circular_slist_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of elements plus the number moved positions. - static node_ptr move_forward(const node_ptr & p, std::size_t n) + static node_ptr move_forward(node_ptr p, std::size_t n) { //Null shift, nothing to do if(!n) return node_ptr(); diff --git a/include/boost/intrusive/derivation_value_traits.hpp b/include/boost/intrusive/derivation_value_traits.hpp index 0699198..223b983 100644 --- a/include/boost/intrusive/derivation_value_traits.hpp +++ b/include/boost/intrusive/derivation_value_traits.hpp @@ -65,7 +65,7 @@ struct derivation_value_traits static const_pointer to_value_ptr(const const_node_ptr &n) { - return pointer_traits::pointer_to(static_cast(*n)); + return pointer_traits::pointer_to(static_cast(*n)); } }; diff --git a/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/include/boost/intrusive/detail/any_node_and_algorithms.hpp index 26a1edc..f044918 100644 --- a/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -52,13 +52,13 @@ struct any_list_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->node_ptr_1 = next; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const const_node_ptr & n) { return n->node_ptr_2; } - BOOST_INTRUSIVE_FORCEINLINE static void set_previous(const node_ptr & n, const node_ptr & prev) + BOOST_INTRUSIVE_FORCEINLINE static void set_previous(node_ptr n, node_ptr prev) { n->node_ptr_2 = prev; } }; @@ -73,7 +73,7 @@ struct any_slist_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->node_ptr_1 = next; } }; @@ -93,13 +93,13 @@ struct any_unordered_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->node_ptr_1 = next; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_prev_in_group(const const_node_ptr & n) { return n->node_ptr_2; } - BOOST_INTRUSIVE_FORCEINLINE static void set_prev_in_group(const node_ptr & n, const node_ptr & prev) + BOOST_INTRUSIVE_FORCEINLINE static void set_prev_in_group(node_ptr n, node_ptr prev) { n->node_ptr_2 = prev; } BOOST_INTRUSIVE_FORCEINLINE static std::size_t get_hash(const const_node_ptr & n) @@ -122,19 +122,19 @@ struct any_rbtree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->node_ptr_1 = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) { return n->node_ptr_2; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->node_ptr_2 = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) { return n->node_ptr_3; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->node_ptr_3 = r; } BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n) @@ -163,19 +163,19 @@ struct any_avltree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->node_ptr_1 = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) { return n->node_ptr_2; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->node_ptr_2 = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) { return n->node_ptr_3; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->node_ptr_3 = r; } BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n) @@ -205,19 +205,19 @@ struct any_tree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n) { return n->node_ptr_1; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->node_ptr_1 = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) { return n->node_ptr_2; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->node_ptr_2 = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) { return n->node_ptr_3; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->node_ptr_3 = r; } }; diff --git a/include/boost/intrusive/detail/avltree_node.hpp b/include/boost/intrusive/detail/avltree_node.hpp index 16d1c1d..85a8642 100644 --- a/include/boost/intrusive/detail/avltree_node.hpp +++ b/include/boost/intrusive/detail/avltree_node.hpp @@ -63,7 +63,7 @@ struct avltree_node template struct default_avltree_node_traits_impl { - typedef avltree_node node; + typedef avltree_node node; typedef typename node::node_ptr node_ptr; typedef typename node::const_node_ptr const_node_ptr; @@ -75,7 +75,7 @@ struct default_avltree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { return n->parent_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->parent_ = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) @@ -84,7 +84,7 @@ struct default_avltree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { return n->left_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->left_ = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) @@ -93,7 +93,7 @@ struct default_avltree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { return n->right_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->right_ = r; } BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n) @@ -121,8 +121,8 @@ template struct compact_avltree_node_traits_impl { typedef compact_avltree_node node; - typedef typename node::node_ptr node_ptr; - typedef typename node::const_node_ptr const_node_ptr; + typedef typename node::node_ptr node_ptr; + typedef typename node::const_node_ptr const_node_ptr; typedef typename node::balance balance; typedef pointer_plus_bits ptr_bit; @@ -130,19 +130,19 @@ struct compact_avltree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const const_node_ptr & n) { return ptr_bit::get_pointer(n->parent_); } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { ptr_bit::set_pointer(n->parent_, p); } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) { return n->left_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->left_ = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) { return n->right_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->right_ = r; } BOOST_INTRUSIVE_FORCEINLINE static balance get_balance(const const_node_ptr & n) diff --git a/include/boost/intrusive/detail/common_slist_algorithms.hpp b/include/boost/intrusive/detail/common_slist_algorithms.hpp index 5e6ff4d..88f3fed 100644 --- a/include/boost/intrusive/detail/common_slist_algorithms.hpp +++ b/include/boost/intrusive/detail/common_slist_algorithms.hpp @@ -52,7 +52,7 @@ class common_slist_algorithms return p; } - BOOST_INTRUSIVE_FORCEINLINE static void init(const node_ptr & this_node) + BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr this_node) { NodeTraits::set_next(this_node, node_ptr()); } BOOST_INTRUSIVE_FORCEINLINE static bool unique(const const_node_ptr & this_node) @@ -64,29 +64,29 @@ class common_slist_algorithms BOOST_INTRUSIVE_FORCEINLINE static bool inited(const const_node_ptr & this_node) { return !NodeTraits::get_next(this_node); } - BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(const node_ptr & prev_node) + BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(node_ptr prev_node) { const_node_ptr this_node(NodeTraits::get_next(prev_node)); NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node)); } - BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(const node_ptr & prev_node, const node_ptr & last_node) + BOOST_INTRUSIVE_FORCEINLINE static void unlink_after(node_ptr prev_node, node_ptr last_node) { NodeTraits::set_next(prev_node, last_node); } - BOOST_INTRUSIVE_FORCEINLINE static void link_after(const node_ptr & prev_node, const node_ptr & this_node) + BOOST_INTRUSIVE_FORCEINLINE static void link_after(node_ptr prev_node, node_ptr this_node) { NodeTraits::set_next(this_node, NodeTraits::get_next(prev_node)); NodeTraits::set_next(prev_node, this_node); } - BOOST_INTRUSIVE_FORCEINLINE static void incorporate_after(const node_ptr & bp, const node_ptr & b, const node_ptr & be) + BOOST_INTRUSIVE_FORCEINLINE static void incorporate_after(node_ptr bp, node_ptr b, node_ptr be) { node_ptr p(NodeTraits::get_next(bp)); NodeTraits::set_next(bp, b); NodeTraits::set_next(be, p); } - static void transfer_after(const node_ptr & bp, const node_ptr & bb, const node_ptr & be) + static void transfer_after(node_ptr bp, node_ptr bb, node_ptr be) { if (bp != bb && bp != be && bb != be) { node_ptr next_b = NodeTraits::get_next(bb); @@ -107,7 +107,7 @@ class common_slist_algorithms }; template - static void stable_partition(node_ptr before_beg, const node_ptr &end, Pred pred, stable_partition_info &info) + static void stable_partition(node_ptr before_beg, node_ptr end, Pred pred, stable_partition_info &info) { node_ptr bcur = before_beg; node_ptr cur = node_traits::get_next(bcur); diff --git a/include/boost/intrusive/detail/list_iterator.hpp b/include/boost/intrusive/detail/list_iterator.hpp index 6c5f161..3aae2d5 100644 --- a/include/boost/intrusive/detail/list_iterator.hpp +++ b/include/boost/intrusive/detail/list_iterator.hpp @@ -66,7 +66,7 @@ class list_iterator : members_(other.pointed_node(), other.get_value_traits()) {} - BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const { return members_.nodeptr_; } BOOST_INTRUSIVE_FORCEINLINE list_iterator &operator=(const node_ptr &node) diff --git a/include/boost/intrusive/detail/list_node.hpp b/include/boost/intrusive/detail/list_node.hpp index c3b4847..bc30e89 100644 --- a/include/boost/intrusive/detail/list_node.hpp +++ b/include/boost/intrusive/detail/list_node.hpp @@ -53,7 +53,7 @@ struct list_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_previous(const node_ptr & n) { return n->prev_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_previous(const node_ptr & n, const node_ptr & prev) + BOOST_INTRUSIVE_FORCEINLINE static void set_previous(node_ptr n, node_ptr prev) { n->prev_ = prev; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const const_node_ptr & n) @@ -62,7 +62,7 @@ struct list_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n) { return n->next_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } }; diff --git a/include/boost/intrusive/detail/node_cloner_disposer.hpp b/include/boost/intrusive/detail/node_cloner_disposer.hpp index 3fe2954..8ed3c4d 100644 --- a/include/boost/intrusive/detail/node_cloner_disposer.hpp +++ b/include/boost/intrusive/detail/node_cloner_disposer.hpp @@ -59,7 +59,7 @@ struct node_cloner {} // tree-based containers use this method, which is proxy-reference friendly - node_ptr operator()(const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(const node_ptr & p) { reference_type v = *traits_->to_value_ptr(p); node_ptr n = traits_->to_node_ptr(*base_t::get()(v)); @@ -89,7 +89,7 @@ struct node_disposer : base_t(f), traits_(cont) {} - void operator()(const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE void operator()(const node_ptr & p) { if(safemode_or_autounlink) node_algorithms::init(p); diff --git a/include/boost/intrusive/detail/rbtree_node.hpp b/include/boost/intrusive/detail/rbtree_node.hpp index 68f4bdf..8b573ec 100644 --- a/include/boost/intrusive/detail/rbtree_node.hpp +++ b/include/boost/intrusive/detail/rbtree_node.hpp @@ -80,7 +80,7 @@ struct default_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { return n->parent_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->parent_ = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) @@ -89,7 +89,7 @@ struct default_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { return n->left_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->left_ = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) @@ -98,7 +98,7 @@ struct default_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { return n->right_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->right_ = r; } BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n) @@ -136,7 +136,7 @@ struct compact_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { return ptr_bit::get_pointer(n->parent_); } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { ptr_bit::set_pointer(n->parent_, p); } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) @@ -145,7 +145,7 @@ struct compact_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { return n->left_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->left_ = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) @@ -154,7 +154,7 @@ struct compact_rbtree_node_traits_impl BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { return n->right_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->right_ = r; } BOOST_INTRUSIVE_FORCEINLINE static color get_color(const const_node_ptr & n) diff --git a/include/boost/intrusive/detail/simple_disposers.hpp b/include/boost/intrusive/detail/simple_disposers.hpp index 1420b28..f9d23bf 100644 --- a/include/boost/intrusive/detail/simple_disposers.hpp +++ b/include/boost/intrusive/detail/simple_disposers.hpp @@ -39,7 +39,7 @@ class init_disposer typedef typename NodeAlgorithms::node_ptr node_ptr; public: - void operator()(const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE void operator()(const node_ptr & p) { NodeAlgorithms::init(p); } }; diff --git a/include/boost/intrusive/detail/slist_iterator.hpp b/include/boost/intrusive/detail/slist_iterator.hpp index 63ce5c3..96a5ac0 100644 --- a/include/boost/intrusive/detail/slist_iterator.hpp +++ b/include/boost/intrusive/detail/slist_iterator.hpp @@ -68,7 +68,7 @@ class slist_iterator : members_(other.pointed_node(), other.get_value_traits()) {} - BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const { return members_.nodeptr_; } BOOST_INTRUSIVE_FORCEINLINE slist_iterator &operator=(const node_ptr &node) diff --git a/include/boost/intrusive/detail/slist_node.hpp b/include/boost/intrusive/detail/slist_node.hpp index 848764e..ee8ab40 100644 --- a/include/boost/intrusive/detail/slist_node.hpp +++ b/include/boost/intrusive/detail/slist_node.hpp @@ -52,7 +52,7 @@ struct slist_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_next(const node_ptr & n) { return n->next_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_next(const node_ptr & n, const node_ptr & next) + BOOST_INTRUSIVE_FORCEINLINE static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } }; diff --git a/include/boost/intrusive/detail/tree_iterator.hpp b/include/boost/intrusive/detail/tree_iterator.hpp index f36a1f2..a4bbc1b 100644 --- a/include/boost/intrusive/detail/tree_iterator.hpp +++ b/include/boost/intrusive/detail/tree_iterator.hpp @@ -74,7 +74,7 @@ class tree_iterator : members_(other.pointed_node(), other.get_value_traits()) {} - BOOST_INTRUSIVE_FORCEINLINE const node_ptr &pointed_node() const + BOOST_INTRUSIVE_FORCEINLINE node_ptr pointed_node() const { return members_.nodeptr_; } BOOST_INTRUSIVE_FORCEINLINE tree_iterator &operator=(const node_ptr &nodeptr) diff --git a/include/boost/intrusive/detail/tree_node.hpp b/include/boost/intrusive/detail/tree_node.hpp index 606fbc8..6df3343 100644 --- a/include/boost/intrusive/detail/tree_node.hpp +++ b/include/boost/intrusive/detail/tree_node.hpp @@ -50,7 +50,7 @@ struct tree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_parent(const node_ptr & n) { return n->parent_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_parent(const node_ptr & n, const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE static void set_parent(node_ptr n, node_ptr p) { n->parent_ = p; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const const_node_ptr & n) @@ -59,7 +59,7 @@ struct tree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_left(const node_ptr & n) { return n->left_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_left(const node_ptr & n, const node_ptr & l) + BOOST_INTRUSIVE_FORCEINLINE static void set_left(node_ptr n, node_ptr l) { n->left_ = l; } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const const_node_ptr & n) @@ -68,7 +68,7 @@ struct tree_node_traits BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_right(const node_ptr & n) { return n->right_; } - BOOST_INTRUSIVE_FORCEINLINE static void set_right(const node_ptr & n, const node_ptr & r) + BOOST_INTRUSIVE_FORCEINLINE static void set_right(node_ptr n, node_ptr r) { n->right_ = r; } }; diff --git a/include/boost/intrusive/hashtable.hpp b/include/boost/intrusive/hashtable.hpp index 258e601..1f1f169 100644 --- a/include/boost/intrusive/hashtable.hpp +++ b/include/boost/intrusive/hashtable.hpp @@ -375,7 +375,7 @@ struct group_functions typedef circular_slist_algorithms node_algorithms; static slist_node_ptr get_bucket_before_begin - (const slist_node_ptr &bucket_beg, const slist_node_ptr &bucket_end, const node_ptr &p) + (slist_node_ptr bucket_beg, slist_node_ptr bucket_end, node_ptr p) { //First find the last node of p's group. //This requires checking the first node of the next group or @@ -406,7 +406,7 @@ struct group_functions return possible_end; } - static node_ptr get_prev_to_first_in_group(const slist_node_ptr &bucket_node, const node_ptr &first_in_group) + static node_ptr get_prev_to_first_in_group(slist_node_ptr bucket_node, node_ptr first_in_group) { node_ptr nb = detail::dcast_bucket_ptr(bucket_node); node_ptr n; @@ -416,7 +416,7 @@ struct group_functions return nb; } - static void erase_from_group(const slist_node_ptr &end_ptr, const node_ptr &to_erase_ptr, detail::true_) + static void erase_from_group(slist_node_ptr end_ptr, node_ptr to_erase_ptr, detail::true_) { node_ptr const nxt_ptr(node_traits::get_next(to_erase_ptr)); //Check if the next node is in the group (not end node) and reverse linked to @@ -429,7 +429,7 @@ struct group_functions BOOST_INTRUSIVE_FORCEINLINE static void erase_from_group(const slist_node_ptr&, const node_ptr&, detail::false_) {} - BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_last_in_group(const node_ptr &first_in_group, detail::true_) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_last_in_group(node_ptr first_in_group, detail::true_) { return group_traits::get_next(first_in_group); } BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_last_in_group(node_ptr n, detail::false_) @@ -449,10 +449,10 @@ struct group_functions return node_traits::get_next(group_traits::get_next(ptr)); } - BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_first_in_group(const node_ptr &n, detail::false_) + BOOST_INTRUSIVE_FORCEINLINE static node_ptr get_first_in_group(node_ptr n, detail::false_) { return n; } - BOOST_INTRUSIVE_FORCEINLINE static void insert_in_group(const node_ptr &first_in_group, const node_ptr &n, true_) + BOOST_INTRUSIVE_FORCEINLINE static void insert_in_group(node_ptr first_in_group, node_ptr n, true_) { group_algorithms::link_after(first_in_group, n); } static void insert_in_group(const node_ptr&, const node_ptr&, false_) @@ -672,8 +672,8 @@ struct bucket_plus_vtraits typedef detail::bucket_impl bucket_type; typedef detail::group_functions group_functions_t; typedef typename slist_impl::node_algorithms node_algorithms; - typedef typename slist_impl::node_ptr slist_node_ptr; - typedef typename node_traits::node_ptr node_ptr; + typedef typename slist_impl::node_ptr slist_node_ptr; + typedef typename node_traits::node_ptr node_ptr; typedef typename node_traits::node node; typedef typename value_traits::value_type value_type; typedef typename value_traits::pointer pointer; @@ -1383,15 +1383,15 @@ struct hashdata_internal ::reference const_reference; typedef typename value_traits::node_traits node_traits; typedef typename node_traits::node node; - typedef typename node_traits::node_ptr node_ptr; - typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename node_traits::node_ptr node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; typedef detail::node_functions node_functions_t; typedef typename detail::get_slist_impl ::type >::type slist_impl; typedef typename slist_impl::node_algorithms node_algorithms; - typedef typename slist_impl::node_ptr slist_node_ptr; + typedef typename slist_impl::node_ptr slist_node_ptr; typedef hash_key_types_base < typename ValueTraits::value_type @@ -1740,7 +1740,7 @@ class hashtable_impl //See documentation for more explanations BOOST_STATIC_ASSERT((!compare_hash || store_hash)); - typedef typename slist_impl::node_ptr slist_node_ptr; + typedef typename slist_impl::node_ptr slist_node_ptr; typedef typename pointer_traits ::template rebind_pointer < void >::type void_pointer; diff --git a/include/boost/intrusive/linear_slist_algorithms.hpp b/include/boost/intrusive/linear_slist_algorithms.hpp index 6c8e9b7..6aeb036 100644 --- a/include/boost/intrusive/linear_slist_algorithms.hpp +++ b/include/boost/intrusive/linear_slist_algorithms.hpp @@ -184,7 +184,7 @@ class linear_slist_algorithms //! Complexity: Constant //! //! Throws: Nothing. - static void swap_trailing_nodes(const node_ptr & this_node, const node_ptr & other_node) + static void swap_trailing_nodes(node_ptr this_node, node_ptr other_node) { node_ptr this_nxt = NodeTraits::get_next(this_node); node_ptr other_nxt = NodeTraits::get_next(other_node); @@ -199,7 +199,7 @@ class linear_slist_algorithms //! Throws: Nothing. //! //! Complexity: This function is linear to the contained elements. - static node_ptr reverse(const node_ptr & p) + static node_ptr reverse(node_ptr p) { if(!p) return node_ptr(); node_ptr i = NodeTraits::get_next(p); @@ -222,7 +222,7 @@ class linear_slist_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of elements plus the number moved positions. - static std::pair move_first_n_backwards(const node_ptr & p, std::size_t n) + static std::pair move_first_n_backwards(node_ptr p, std::size_t n) { std::pair ret; //Null shift, or count() == 0 or 1, nothing to do @@ -277,7 +277,7 @@ class linear_slist_algorithms //! Throws: Nothing. //! //! Complexity: Linear to the number of elements plus the number moved positions. - static std::pair move_first_n_forward(const node_ptr & p, std::size_t n) + static std::pair move_first_n_forward(node_ptr p, std::size_t n) { std::pair ret; //Null shift, or count() == 0 or 1, nothing to do diff --git a/include/boost/intrusive/rbtree_algorithms.hpp b/include/boost/intrusive/rbtree_algorithms.hpp index 6a7c563..ee5e13a 100644 --- a/include/boost/intrusive/rbtree_algorithms.hpp +++ b/include/boost/intrusive/rbtree_algorithms.hpp @@ -54,7 +54,7 @@ struct rbtree_node_cloner : base_t(f) {} - node_ptr operator()(const node_ptr & p) + BOOST_INTRUSIVE_FORCEINLINE node_ptr operator()(node_ptr p) { node_ptr n = base_t::get()(p); NodeTraits::set_color(n, NodeTraits::get_color(p)); @@ -200,12 +200,12 @@ class rbtree_algorithms static node_ptr end_node(const const_node_ptr & header); //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree - static void swap_tree(const node_ptr & header1, const node_ptr & header2); + static void swap_tree(node_ptr header1, node_ptr header2); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & node2) + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr node2) { if(node1 == node2) return; @@ -214,8 +214,8 @@ class rbtree_algorithms swap_nodes(node1, header1, node2, header2); } - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2) + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr,node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2) { if(node1 == node2) return; @@ -226,22 +226,22 @@ class rbtree_algorithms NodeTraits::set_color(node2, c); } - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node) { if(node_to_be_replaced == new_node) return; replace_node(node_to_be_replaced, bstree_algo::get_header(node_to_be_replaced), new_node); } - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) { bstree_algo::replace_node(node_to_be_replaced, header, new_node); NodeTraits::set_color(new_node, NodeTraits::get_color(node_to_be_replaced)); } - //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) static void unlink(const node_ptr& node) { node_ptr x = NodeTraits::get_parent(node); @@ -268,19 +268,19 @@ class rbtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&) static node_ptr prev_node(const node_ptr & node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) static void init(const node_ptr & node); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&) - static void init_header(const node_ptr & header) + //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) + static void init_header(node_ptr header) { bstree_algo::init_header(header); NodeTraits::set_color(header, NodeTraits::red()); } - //! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&) - static node_ptr erase(const node_ptr & header, const node_ptr & z) + //! @copydoc ::boost::intrusive::bstree_algorithms::erase(node_ptr,node_ptr) + static node_ptr erase(node_ptr header, node_ptr z) { typename bstree_algo::data_for_rebalance info; bstree_algo::erase(header, z, info); @@ -291,7 +291,7 @@ class rbtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique template static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { typename bstree_algo::data_for_rebalance info; bool const transferred = bstree_algo::transfer_unique(header1, comp, header2, z, info); @@ -305,7 +305,7 @@ class rbtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal template static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { typename bstree_algo::data_for_rebalance info; bstree_algo::transfer_equal(header1, comp, header2, z, info); @@ -313,10 +313,10 @@ class rbtree_algorithms rebalance_after_insertion(header1, z); } - //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer) + //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,node_ptr,Cloner,Disposer) template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer) + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer) { rbtree_node_cloner new_cloner(cloner); bstree_algo::clone(source_header, target_header, new_cloner, disposer); @@ -359,54 +359,54 @@ class rbtree_algorithms #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_upper_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal_upper_bound(h, new_node, comp); rebalance_after_insertion(h, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_lower_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal_lower_bound(h, new_node, comp); rebalance_after_insertion(h, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(node_ptr,node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal - (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) { bstree_algo::insert_equal(header, hint, new_node, comp); rebalance_after_insertion(header, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(node_ptr,node_ptr,node_ptr) static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node) + (node_ptr header, node_ptr pos, node_ptr new_node) { bstree_algo::insert_before(header, pos, new_node); rebalance_after_insertion(header, new_node); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&) - static void push_back(const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(node_ptr,node_ptr) + static void push_back(node_ptr header, node_ptr new_node) { bstree_algo::push_back(header, new_node); rebalance_after_insertion(header, new_node); } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&) - static void push_front(const node_ptr & header, const node_ptr & new_node) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(node_ptr,node_ptr) + static void push_front(node_ptr header, node_ptr new_node) { bstree_algo::push_front(header, new_node); rebalance_after_insertion(header, new_node); @@ -416,19 +416,19 @@ class rbtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&) template static std::pair insert_unique_check - (const const_node_ptr & header, const KeyType &key + (const_node_ptr header, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data); //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&) template static std::pair insert_unique_check - (const const_node_ptr & header, const node_ptr &hint, const KeyType &key + (const_node_ptr header, node_ptr hint, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(node_ptr,node_ptr,const insert_commit_data&) static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data) + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data) { bstree_algo::insert_unique_commit(header, new_value, commit_data); rebalance_after_insertion(header, new_value); @@ -445,7 +445,7 @@ class rbtree_algorithms private: static void rebalance_after_erasure - ( const node_ptr & header, const node_ptr &z, const typename bstree_algo::data_for_rebalance &info) + ( node_ptr header, node_ptr z, const typename bstree_algo::data_for_rebalance &info) { color new_z_color; if(info.y != z){ @@ -461,7 +461,7 @@ class rbtree_algorithms } } - static void rebalance_after_erasure_restore_invariants(const node_ptr & header, node_ptr x, node_ptr x_parent) + static void rebalance_after_erasure_restore_invariants(node_ptr header, node_ptr x, node_ptr x_parent) { while(1){ if(x_parent == header || (x && NodeTraits::get_color(x) != NodeTraits::black())){ @@ -545,7 +545,7 @@ class rbtree_algorithms NodeTraits::set_color(x, NodeTraits::black()); } - static void rebalance_after_insertion(const node_ptr & header, node_ptr p) + static void rebalance_after_insertion(node_ptr header, node_ptr p) { NodeTraits::set_color(p, NodeTraits::red()); while(1){ diff --git a/include/boost/intrusive/sgtree_algorithms.hpp b/include/boost/intrusive/sgtree_algorithms.hpp index e6002a7..a3e233c 100644 --- a/include/boost/intrusive/sgtree_algorithms.hpp +++ b/include/boost/intrusive/sgtree_algorithms.hpp @@ -65,8 +65,8 @@ class sgtree_algorithms public: typedef typename NodeTraits::node node; typedef NodeTraits node_traits; - typedef typename NodeTraits::node_ptr node_ptr; - typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; /// @cond private: @@ -86,57 +86,57 @@ class sgtree_algorithms #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&) - static node_ptr get_header(const const_node_ptr & n); + static node_ptr get_header(const_node_ptr n); //! @copydoc ::boost::intrusive::bstree_algorithms::begin_node - static node_ptr begin_node(const const_node_ptr & header); + static node_ptr begin_node(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::end_node - static node_ptr end_node(const const_node_ptr & header); + static node_ptr end_node(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree - static void swap_tree(const node_ptr & header1, const node_ptr & header2); + static void swap_tree(node_ptr header1, node_ptr header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & node2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr node2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr,node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node); //Unlink is not possible since tree metadata is needed to update the tree - //!static void unlink(const node_ptr & node); + //!static void unlink(node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance - static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header); + static node_ptr unlink_leftmost_without_rebalance(node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&) - static bool unique(const const_node_ptr & node); + static bool unique(const_node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&) - static std::size_t size(const const_node_ptr & header); + static std::size_t size(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&) - static node_ptr next_node(const node_ptr & node); + static node_ptr next_node(node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&) - static node_ptr prev_node(const node_ptr & node); + static node_ptr prev_node(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&) - static void init(const node_ptr & node); + //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) + static void init(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&) - static void init_header(const node_ptr & header); + //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) + static void init_header(node_ptr header); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::erase(node_ptr,node_ptr) template - static node_ptr erase(const node_ptr & header, const node_ptr & z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize) + static node_ptr erase(node_ptr header, node_ptr z, std::size_t tree_size, std::size_t &max_tree_size, AlphaByMaxSize alpha_by_maxsize) { bstree_algo::erase(header, z); --tree_size; @@ -149,51 +149,51 @@ class sgtree_algorithms } #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer) + //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,node_ptr,Cloner,Disposer) template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer); + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer); //! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer) template - static void clear_and_dispose(const node_ptr & header, Disposer disposer); + static void clear_and_dispose(node_ptr header, Disposer disposer); //! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static node_ptr lower_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static node_ptr upper_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare) template static node_ptr find - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static std::pair equal_range - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool) template static std::pair bounded_range - (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + (const_node_ptr header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp , bool left_closed, bool right_closed); //! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template - static std::size_t count(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + static std::size_t count(const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_upper_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp + (node_ptr h, node_ptr new_node, NodePtrCompare comp ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -202,10 +202,10 @@ class sgtree_algorithms return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal_lower_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp + (node_ptr h, node_ptr new_node, NodePtrCompare comp ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -214,10 +214,10 @@ class sgtree_algorithms return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(node_ptr,node_ptr,node_ptr,NodePtrCompare) template static node_ptr insert_equal - (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -226,10 +226,10 @@ class sgtree_algorithms return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(node_ptr,node_ptr,node_ptr) template static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node + (node_ptr header, node_ptr pos, node_ptr new_node ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -238,9 +238,9 @@ class sgtree_algorithms return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(node_ptr,node_ptr) template - static void push_back(const node_ptr & header, const node_ptr & new_node + static void push_back(node_ptr header, node_ptr new_node ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -248,9 +248,9 @@ class sgtree_algorithms rebalance_after_insertion(new_node, depth, tree_size+1, h_alpha, max_tree_size); } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(node_ptr,node_ptr) template - static void push_front(const node_ptr & header, const node_ptr & new_node + static void push_front(node_ptr header, node_ptr new_node ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { std::size_t depth; @@ -261,7 +261,7 @@ class sgtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&) template static std::pair insert_unique_check - (const const_node_ptr & header, const KeyType &key + (const_node_ptr header, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data) { std::size_t depth; @@ -274,7 +274,7 @@ class sgtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_check(const const_node_ptr&,const node_ptr&,const KeyType&,KeyNodePtrCompare,insert_commit_data&) template static std::pair insert_unique_check - (const const_node_ptr & header, const node_ptr &hint, const KeyType &key + (const_node_ptr header, node_ptr hint, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data) { std::size_t depth; @@ -285,18 +285,18 @@ class sgtree_algorithms return ret; } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(node_ptr,node_ptr,const insert_commit_data&) template BOOST_INTRUSIVE_FORCEINLINE static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { return insert_commit(header, new_value, commit_data, tree_size, h_alpha, max_tree_size); } //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique template static bool transfer_unique - ( const node_ptr & header1, NodePtrCompare comp, std::size_t tree1_size, std::size_t &max_tree1_size - , const node_ptr &header2, const node_ptr & z, std::size_t tree2_size, std::size_t &max_tree2_size + ( node_ptr header1, NodePtrCompare comp, std::size_t tree1_size, std::size_t &max_tree1_size + , node_ptr header2, node_ptr z, std::size_t tree2_size, std::size_t &max_tree2_size ,H_Alpha h_alpha, AlphaByMaxSize alpha_by_maxsize) { insert_commit_data commit_data; @@ -311,8 +311,8 @@ class sgtree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal template static void transfer_equal - ( const node_ptr & header1, NodePtrCompare comp, std::size_t tree1_size, std::size_t &max_tree1_size - , const node_ptr &header2, const node_ptr & z, std::size_t tree2_size, std::size_t &max_tree2_size + ( node_ptr header1, NodePtrCompare comp, std::size_t tree1_size, std::size_t &max_tree1_size + , node_ptr header2, node_ptr z, std::size_t tree2_size, std::size_t &max_tree2_size ,H_Alpha h_alpha, AlphaByMaxSize alpha_by_maxsize) { insert_commit_data commit_data; @@ -323,13 +323,13 @@ class sgtree_algorithms #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::is_header - static bool is_header(const const_node_ptr & p); + static bool is_header(const_node_ptr p); //! @copydoc ::boost::intrusive::bstree_algorithms::is_header - static void rebalance(const node_ptr & header); + static void rebalance(node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::rebalance_subtree - static node_ptr rebalance_subtree(const node_ptr & old_root) + static node_ptr rebalance_subtree(node_ptr old_root) #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED /// @cond @@ -337,7 +337,7 @@ class sgtree_algorithms template static void insert_equal_upper_bound_check - (const node_ptr & header, const KeyType &key + (node_ptr header, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data) { std::size_t depth; @@ -347,7 +347,7 @@ class sgtree_algorithms template static void insert_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data ,std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { bstree_algo::insert_unique_commit(header, new_value, commit_data); @@ -356,7 +356,7 @@ class sgtree_algorithms template static void rebalance_after_insertion - (const node_ptr &x, std::size_t depth + (node_ptr x, std::size_t depth , std::size_t tree_size, H_Alpha h_alpha, std::size_t &max_tree_size) { if(tree_size > max_tree_size) diff --git a/include/boost/intrusive/slist.hpp b/include/boost/intrusive/slist.hpp index 1f7ace1..1dc90a8 100644 --- a/include/boost/intrusive/slist.hpp +++ b/include/boost/intrusive/slist.hpp @@ -1995,7 +1995,7 @@ class slist_impl { x.swap(y); } private: - void priv_splice_after(const node_ptr & prev_pos_n, slist_impl &x, const node_ptr & before_f_n, const node_ptr & before_l_n) + void priv_splice_after(node_ptr prev_pos_n, slist_impl &x, node_ptr before_f_n, node_ptr before_l_n) { if (cache_last && (before_f_n != before_l_n)){ if(prev_pos_n == this->get_last_node()){ @@ -2008,7 +2008,7 @@ class slist_impl node_algorithms::transfer_after(prev_pos_n, before_f_n, before_l_n); } - void priv_incorporate_after(const node_ptr & prev_pos_n, const node_ptr & first_n, const node_ptr & before_l_n) + void priv_incorporate_after(node_ptr prev_pos_n, node_ptr first_n, node_ptr before_l_n) { if(cache_last){ if(prev_pos_n == this->get_last_node()){ @@ -2108,11 +2108,11 @@ class slist_impl } //circular version - static void priv_swap_lists(const node_ptr & this_node, const node_ptr & other_node, detail::bool_) + static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_) { node_algorithms::swap_nodes(this_node, other_node); } //linear version - static void priv_swap_lists(const node_ptr & this_node, const node_ptr & other_node, detail::bool_) + static void priv_swap_lists(node_ptr this_node, node_ptr other_node, detail::bool_) { node_algorithms::swap_trailing_nodes(this_node, other_node); } static slist_impl &priv_container_from_end_iterator(const const_iterator &end_iterator) diff --git a/include/boost/intrusive/splaytree_algorithms.hpp b/include/boost/intrusive/splaytree_algorithms.hpp index be2e182..6376d32 100644 --- a/include/boost/intrusive/splaytree_algorithms.hpp +++ b/include/boost/intrusive/splaytree_algorithms.hpp @@ -54,7 +54,7 @@ struct splaydown_assemble_and_fix_header { typedef typename NodeTraits::node_ptr node_ptr; - splaydown_assemble_and_fix_header(const node_ptr & t, const node_ptr & header, const node_ptr &leftmost, const node_ptr &rightmost) + splaydown_assemble_and_fix_header(node_ptr t, node_ptr header, node_ptr leftmost, node_ptr rightmost) : t_(t) , null_node_(header) , l_(null_node_) @@ -187,47 +187,47 @@ class splaytree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree static void swap_tree(const node_ptr & header1, const node_ptr & header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & node2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr node2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr,node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node); - //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&) - static void unlink(const node_ptr & node); + //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) + static void unlink(node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance - static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header); + static node_ptr unlink_leftmost_without_rebalance(node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&) - static bool unique(const const_node_ptr & node); + static bool unique(const_node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&) - static std::size_t size(const const_node_ptr & header); + static std::size_t size(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&) - static node_ptr next_node(const node_ptr & node); + static node_ptr next_node(node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&) - static node_ptr prev_node(const node_ptr & node); + static node_ptr prev_node(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&) - static void init(const node_ptr & node); + //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) + static void init(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&) - static void init_header(const node_ptr & header); + //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) + static void init_header(node_ptr header); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::erase(node_ptr,node_ptr) //! Additional notes: the previous node of z is splayed to speed up range deletions. - static void erase(const node_ptr & header, const node_ptr & z) + static void erase(node_ptr header, node_ptr z) { //posibility 1 if(NodeTraits::get_left(z)){ @@ -254,7 +254,7 @@ class splaytree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique template static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { typename bstree_algo::insert_commit_data commit_data; bool const transferable = bstree_algo::insert_unique_check(header1, z, comp, commit_data).second; @@ -269,7 +269,7 @@ class splaytree_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal template static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, node_ptr header2, node_ptr z) { insert_commit_data commit_data; splay_down(header1, z, comp); @@ -279,21 +279,21 @@ class splaytree_algorithms } #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer) + //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,node_ptr,Cloner,Disposer) template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer); + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer); //! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer) template - static void clear_and_dispose(const node_ptr & header, Disposer disposer); + static void clear_and_dispose(node_ptr header, Disposer disposer); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) //! Additional notes: an element with key `key` is splayed. template static std::size_t count - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { std::pair ret = equal_range(header, key, comp); std::size_t n = 0; @@ -308,14 +308,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static std::size_t count - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::count(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) //! Additional notes: the first node of the range is splayed. template static node_ptr lower_bound - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { splay_down(detail::uncast(header), key, comp); node_ptr y = bstree_algo::lower_bound(header, key, comp); @@ -327,14 +327,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static node_ptr lower_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::lower_bound(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) //! Additional notes: the first node of the range is splayed. template static node_ptr upper_bound - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { splay_down(detail::uncast(header), key, comp); node_ptr y = bstree_algo::upper_bound(header, key, comp); @@ -346,14 +346,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static node_ptr upper_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::upper_bound(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare) //! Additional notes: the found node of the lower bound is splayed. template static node_ptr find - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { splay_down(detail::uncast(header), key, comp); return bstree_algo::find(header, key, comp); @@ -363,14 +363,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static node_ptr find - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::find(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) //! Additional notes: the first node of the range is splayed. template static std::pair equal_range - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { splay_down(detail::uncast(header), key, comp); std::pair ret = bstree_algo::equal_range(header, key, comp); @@ -382,14 +382,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static std::pair equal_range - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::equal_range(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) //! Additional notes: the first node of the range is splayed. template static std::pair lower_bound_range - (const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { splay_down(detail::uncast(header), key, comp); std::pair ret = bstree_algo::lower_bound_range(header, key, comp); @@ -401,14 +401,14 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static std::pair lower_bound_range - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp) + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp) { return bstree_algo::lower_bound_range(header, key, comp); } //! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool) //! Additional notes: the first node of the range is splayed. template static std::pair bounded_range - (const node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + (node_ptr header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp , bool left_closed, bool right_closed) { splay_down(detail::uncast(header), lower_key, comp); @@ -422,61 +422,61 @@ class splaytree_algorithms //! Additional note: no splaying is performed template static std::pair bounded_range - (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + (const_node_ptr header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp , bool left_closed, bool right_closed) { return bstree_algo::bounded_range(header, lower_key, upper_key, comp, left_closed, right_closed); } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_upper_bound(node_ptr,node_ptr,NodePtrCompare) //! Additional note: the inserted node is splayed template static node_ptr insert_equal_upper_bound - (const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr header, node_ptr new_node, NodePtrCompare comp) { splay_down(header, new_node, comp); return bstree_algo::insert_equal_upper_bound(header, new_node, comp); } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal_lower_bound(node_ptr,node_ptr,NodePtrCompare) //! Additional note: the inserted node is splayed template static node_ptr insert_equal_lower_bound - (const node_ptr & header, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr header, node_ptr new_node, NodePtrCompare comp) { splay_down(header, new_node, comp); return bstree_algo::insert_equal_lower_bound(header, new_node, comp); - } + } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(const node_ptr&,const node_ptr&,const node_ptr&,NodePtrCompare) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_equal(node_ptr,node_ptr,node_ptr,NodePtrCompare) //! Additional note: the inserted node is splayed template static node_ptr insert_equal - (const node_ptr & header, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp) + (node_ptr header, node_ptr hint, node_ptr new_node, NodePtrCompare comp) { splay_down(header, new_node, comp); return bstree_algo::insert_equal(header, hint, new_node, comp); } - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(const node_ptr&,const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_before(node_ptr,node_ptr,node_ptr) //! Additional note: the inserted node is splayed static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node) + (node_ptr header, node_ptr pos, node_ptr new_node) { bstree_algo::insert_before(header, pos, new_node); splay_up(new_node, header); return new_node; } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_back(node_ptr,node_ptr) //! Additional note: the inserted node is splayed - static void push_back(const node_ptr & header, const node_ptr & new_node) + static void push_back(node_ptr header, node_ptr new_node) { bstree_algo::push_back(header, new_node); splay_up(new_node, header); } - //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::push_front(node_ptr,node_ptr) //! Additional note: the inserted node is splayed - static void push_front(const node_ptr & header, const node_ptr & new_node) + static void push_front(node_ptr header, node_ptr new_node) { bstree_algo::push_front(header, new_node); splay_up(new_node, header); @@ -486,7 +486,7 @@ class splaytree_algorithms //! Additional note: nodes with the given key are splayed template static std::pair insert_unique_check - (const node_ptr & header, const KeyType &key + (node_ptr header, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data) { splay_down(header, key, comp); @@ -497,7 +497,7 @@ class splaytree_algorithms //! Additional note: nodes with the given key are splayed template static std::pair insert_unique_check - (const node_ptr & header, const node_ptr &hint, const KeyType &key + (node_ptr header, node_ptr hint, const KeyType &key ,KeyNodePtrCompare comp, insert_commit_data &commit_data) { splay_down(header, key, comp); @@ -505,28 +505,28 @@ class splaytree_algorithms } #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(const node_ptr&,const node_ptr&,const insert_commit_data&) + //! @copydoc ::boost::intrusive::bstree_algorithms::insert_unique_commit(node_ptr,node_ptr,const insert_commit_data&) static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_value, const insert_commit_data &commit_data); + (node_ptr header, node_ptr new_value, const insert_commit_data &commit_data); //! @copydoc ::boost::intrusive::bstree_algorithms::is_header - static bool is_header(const const_node_ptr & p); + static bool is_header(const_node_ptr p); //! @copydoc ::boost::intrusive::bstree_algorithms::rebalance - static void rebalance(const node_ptr & header); + static void rebalance(node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::rebalance_subtree - static node_ptr rebalance_subtree(const node_ptr & old_root); + static node_ptr rebalance_subtree(node_ptr old_root); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow - static void splay_up(const node_ptr & node, const node_ptr & header) + static void splay_up(node_ptr node, node_ptr header) { priv_splay_up(node, header); } // top-down splay | complexity : logarithmic | exception : strong, note A template - static node_ptr splay_down(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0) + static node_ptr splay_down(node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0) { return priv_splay_down(header, key, comp, pfound); } private: @@ -535,7 +535,7 @@ class splaytree_algorithms // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow template - static void priv_splay_up(const node_ptr & node, const node_ptr & header) + static void priv_splay_up(node_ptr node, node_ptr header) { // If (node == header) do a splay for the right most node instead // this is to boost performance of equal_range/count on equivalent containers in the case @@ -572,7 +572,7 @@ class splaytree_algorithms } template - static node_ptr priv_splay_down(const node_ptr & header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0) + static node_ptr priv_splay_down(node_ptr header, const KeyType &key, KeyNodePtrCompare comp, bool *pfound = 0) { //Most splay tree implementations use a dummy/null node to implement. //this function. This has some problems for a generic library like Intrusive: @@ -684,7 +684,7 @@ class splaytree_algorithms } // rotate n with its parent | complexity : constant | exception : nothrow - static void rotate(const node_ptr & n) + static void rotate(node_ptr n) { //procedure rotate_left; // t, right(t), left(right(t)) := right(t), left(right(t)), t diff --git a/include/boost/intrusive/treap_algorithms.hpp b/include/boost/intrusive/treap_algorithms.hpp index b1a82b3..e9b8b23 100644 --- a/include/boost/intrusive/treap_algorithms.hpp +++ b/include/boost/intrusive/treap_algorithms.hpp @@ -41,7 +41,7 @@ struct treap_node_extra_checker typedef ExtraChecker base_checker_t; typedef ValueTraits value_traits; typedef typename value_traits::node_traits node_traits; - typedef typename node_traits::const_node_ptr const_node_ptr; + typedef typename node_traits::const_node_ptr const_node_ptr; typedef typename base_checker_t::return_type return_type; @@ -114,8 +114,8 @@ class treap_algorithms public: typedef NodeTraits node_traits; typedef typename NodeTraits::node node; - typedef typename NodeTraits::node_ptr node_ptr; - typedef typename NodeTraits::const_node_ptr const_node_ptr; + typedef typename NodeTraits::node_ptr node_ptr; + typedef typename NodeTraits::const_node_ptr const_node_ptr; /// @cond private: @@ -127,7 +127,7 @@ class treap_algorithms rerotate_on_destroy& operator=(const rerotate_on_destroy&); public: - rerotate_on_destroy(const node_ptr & header, const node_ptr & p, std::size_t &n) + rerotate_on_destroy(node_ptr header, node_ptr p, std::size_t &n) : header_(header), p_(p), n_(n), remove_it_(true) {} @@ -181,33 +181,33 @@ class treap_algorithms #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::get_header(const const_node_ptr&) - static node_ptr get_header(const const_node_ptr & n); + static node_ptr get_header(const_node_ptr n); //! @copydoc ::boost::intrusive::bstree_algorithms::begin_node - static node_ptr begin_node(const const_node_ptr & header); + static node_ptr begin_node(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::end_node - static node_ptr end_node(const const_node_ptr & header); + static node_ptr end_node(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::swap_tree - static void swap_tree(const node_ptr & header1, const node_ptr & header2); + static void swap_tree(node_ptr header1, node_ptr header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & node2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr node2); - //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(const node_ptr&,const node_ptr&,const node_ptr&,const node_ptr&) - static void swap_nodes(const node_ptr & node1, const node_ptr & header1, const node_ptr & node2, const node_ptr & header2); + //! @copydoc ::boost::intrusive::bstree_algorithms::swap_nodes(node_ptr,node_ptr,node_ptr,node_ptr) + static void swap_nodes(node_ptr node1, node_ptr header1, node_ptr node2, node_ptr header2); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr new_node); - //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(const node_ptr&,const node_ptr&,const node_ptr&) - static void replace_node(const node_ptr & node_to_be_replaced, const node_ptr & header, const node_ptr & new_node); + //! @copydoc ::boost::intrusive::bstree_algorithms::replace_node(node_ptr,node_ptr,node_ptr) + static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) template - static void unlink(const node_ptr & node, NodePtrPriorityCompare pcomp) + static void unlink(node_ptr node, NodePtrPriorityCompare pcomp) { node_ptr x = NodeTraits::get_parent(node); if(x){ @@ -219,30 +219,30 @@ class treap_algorithms #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance - static node_ptr unlink_leftmost_without_rebalance(const node_ptr & header); + static node_ptr unlink_leftmost_without_rebalance(node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const const_node_ptr&) - static bool unique(const const_node_ptr & node); + static bool unique(const_node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::size(const const_node_ptr&) - static std::size_t size(const const_node_ptr & header); + static std::size_t size(const_node_ptr header); //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const node_ptr&) - static node_ptr next_node(const node_ptr & node); + static node_ptr next_node(node_ptr node); //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const node_ptr&) - static node_ptr prev_node(const node_ptr & node); + static node_ptr prev_node(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init(const node_ptr&) - static void init(const node_ptr & node); + //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) + static void init(node_ptr node); - //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(const node_ptr&) - static void init_header(const node_ptr & header); + //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) + static void init_header(node_ptr header); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::erase(const node_ptr&,const node_ptr&) + //! @copydoc ::boost::intrusive::bstree_algorithms::erase(node_ptr,node_ptr) template - static node_ptr erase(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp) + static node_ptr erase(node_ptr header, node_ptr z, NodePtrPriorityCompare pcomp) { rebalance_for_erasure(header, z, pcomp); bstree_algo::erase(header, z); @@ -250,44 +250,44 @@ class treap_algorithms } #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,const node_ptr&,Cloner,Disposer) + //! @copydoc ::boost::intrusive::bstree_algorithms::clone(const const_node_ptr&,node_ptr,Cloner,Disposer) template static void clone - (const const_node_ptr & source_header, const node_ptr & target_header, Cloner cloner, Disposer disposer); + (const_node_ptr source_header, node_ptr target_header, Cloner cloner, Disposer disposer); //! @copydoc ::boost::intrusive::bstree_algorithms::clear_and_dispose(const node_ptr&,Disposer) template - static void clear_and_dispose(const node_ptr & header, Disposer disposer); + static void clear_and_dispose(node_ptr header, Disposer disposer); //! @copydoc ::boost::intrusive::bstree_algorithms::lower_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static node_ptr lower_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::upper_bound(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static node_ptr upper_bound - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::find(const const_node_ptr&, const KeyType&,KeyNodePtrCompare) template static node_ptr find - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::equal_range(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template static std::pair equal_range - (const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + (const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); //! @copydoc ::boost::intrusive::bstree_algorithms::bounded_range(const const_node_ptr&,const KeyType&,const KeyType&,KeyNodePtrCompare,bool,bool) template static std::pair bounded_range - (const const_node_ptr & header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp + (const_node_ptr header, const KeyType &lower_key, const KeyType &upper_key, KeyNodePtrCompare comp , bool left_closed, bool right_closed); //! @copydoc ::boost::intrusive::bstree_algorithms::count(const const_node_ptr&,const KeyType&,KeyNodePtrCompare) template - static std::size_t count(const const_node_ptr & header, const KeyType &key, KeyNodePtrCompare comp); + static std::size_t count(const_node_ptr header, const KeyType &key, KeyNodePtrCompare comp); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED @@ -308,7 +308,7 @@ class treap_algorithms //! Throws: If "comp" throw or "pcomp" throw. template static node_ptr insert_equal_upper_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::insert_equal_upper_bound_check(h, new_node, comp, commit_data); @@ -333,7 +333,7 @@ class treap_algorithms //! Throws: If "comp" throws. template static node_ptr insert_equal_lower_bound - (const node_ptr & h, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) + (node_ptr h, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::insert_equal_lower_bound_check(h, new_node, comp, commit_data); @@ -361,7 +361,7 @@ class treap_algorithms //! Throws: If "comp" throw or "pcomp" throw. template static node_ptr insert_equal - (const node_ptr & h, const node_ptr & hint, const node_ptr & new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) + (node_ptr h, node_ptr hint, node_ptr new_node, NodePtrCompare comp, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::insert_equal_check(h, hint, new_node, comp, commit_data); @@ -389,7 +389,7 @@ class treap_algorithms //! tree invariants might be broken. template static node_ptr insert_before - (const node_ptr & header, const node_ptr & pos, const node_ptr & new_node, NodePtrPriorityCompare pcomp) + (node_ptr header, node_ptr pos, node_ptr new_node, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::insert_before_check(header, pos, commit_data); @@ -415,7 +415,7 @@ class treap_algorithms //! tree invariants are broken. This function is slightly faster than //! using "insert_before". template - static void push_back(const node_ptr & header, const node_ptr & new_node, NodePtrPriorityCompare pcomp) + static void push_back(node_ptr header, node_ptr new_node, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::push_back_check(header, commit_data); @@ -440,7 +440,7 @@ class treap_algorithms //! tree invariants are broken. This function is slightly faster than //! using "insert_before". template - static void push_front(const node_ptr & header, const node_ptr & new_node, NodePtrPriorityCompare pcomp) + static void push_front(node_ptr header, node_ptr new_node, NodePtrPriorityCompare pcomp) { insert_commit_data commit_data; bstree_algo::push_front_check(header, commit_data); @@ -483,7 +483,7 @@ class treap_algorithms //! if no more objects are inserted or erased from the set. template static std::pair insert_unique_check - (const const_node_ptr & header, const KeyType &key + (const_node_ptr header, const KeyType &key ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp ,insert_commit_data &commit_data) { @@ -535,7 +535,7 @@ class treap_algorithms //! if no more objects are inserted or erased from the set. template static std::pair insert_unique_check - (const const_node_ptr & header, const node_ptr & hint, const KeyType &key + (const_node_ptr header, node_ptr hint, const KeyType &key ,KeyNodePtrCompare comp, KeyNodePtrPrioCompare pcomp, insert_commit_data &commit_data) { std::pair ret = @@ -563,7 +563,7 @@ class treap_algorithms //! previously executed to fill "commit_data". No value should be inserted or //! erased between the "insert_check" and "insert_commit" calls. static void insert_unique_commit - (const node_ptr & header, const node_ptr & new_node, const insert_commit_data &commit_data) + (node_ptr header, node_ptr new_node, const insert_commit_data &commit_data) { bstree_algo::insert_unique_commit(header, new_node, commit_data); rotate_up_n(header, new_node, commit_data.rotations); @@ -572,7 +572,7 @@ class treap_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_unique template static bool transfer_unique - (const node_ptr & header1, NodePtrCompare comp, KeyNodePtrPrioCompare pcomp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, KeyNodePtrPrioCompare 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; @@ -586,7 +586,7 @@ class treap_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::transfer_equal template static void transfer_equal - (const node_ptr & header1, NodePtrCompare comp, KeyNodePtrPrioCompare pcomp, const node_ptr &header2, const node_ptr & z) + (node_ptr header1, NodePtrCompare comp, KeyNodePtrPrioCompare pcomp, node_ptr header2, node_ptr z) { insert_commit_data commit_data; bstree_algo::insert_equal_upper_bound_check(header1, z, comp, commit_data); @@ -600,14 +600,14 @@ class treap_algorithms #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::is_header - static bool is_header(const const_node_ptr & p); + static bool is_header(const_node_ptr p); #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED /// @cond private: template - static void rebalance_for_erasure(const node_ptr & header, const node_ptr & z, NodePtrPriorityCompare pcomp) + static void rebalance_for_erasure(node_ptr header, node_ptr z, NodePtrPriorityCompare pcomp) { std::size_t n = 0; rerotate_on_destroy rb(header, z, n); @@ -631,7 +631,7 @@ class treap_algorithms template static void rebalance_check_and_commit - (const node_ptr & h, const node_ptr & new_node, NodePtrPriorityCompare pcomp, insert_commit_data &commit_data) + (node_ptr h, node_ptr new_node, NodePtrPriorityCompare pcomp, insert_commit_data &commit_data) { rebalance_after_insertion_check(h, commit_data.node, new_node, pcomp, commit_data.rotations); //No-throw @@ -641,7 +641,7 @@ class treap_algorithms template static void rebalance_after_insertion_check - (const const_node_ptr &header, const const_node_ptr & up, const Key &k + (const_node_ptr header, const_node_ptr up, const Key &k , KeyNodePriorityCompare pcomp, std::size_t &num_rotations) { const_node_ptr upnode(up); @@ -656,7 +656,7 @@ class treap_algorithms } template - static bool check_invariant(const const_node_ptr & header, NodePtrPriorityCompare pcomp) + static bool check_invariant(const_node_ptr header, NodePtrPriorityCompare pcomp) { node_ptr beg = begin_node(header); node_ptr end = end_node(header); diff --git a/include/boost/intrusive/unordered_set_hook.hpp b/include/boost/intrusive/unordered_set_hook.hpp index a18d235..f03940b 100644 --- a/include/boost/intrusive/unordered_set_hook.hpp +++ b/include/boost/intrusive/unordered_set_hook.hpp @@ -85,13 +85,13 @@ struct unordered_node_traits static node_ptr get_next(const const_node_ptr & n) { return pointer_traits::static_cast_from(n->next_); } - static void set_next(const node_ptr & n, const node_ptr & next) + 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) { return n->prev_in_group_; } - static void set_prev_in_group(const node_ptr & n, const node_ptr & prev) + 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) @@ -111,7 +111,7 @@ struct unordered_group_adapter static node_ptr get_next(const const_node_ptr & n) { return NodeTraits::get_prev_in_group(n); } - static void set_next(const node_ptr & n, const node_ptr & next) + static void set_next(node_ptr n, node_ptr next) { NodeTraits::set_prev_in_group(n, next); } }; diff --git a/perf/perf_list.cpp b/perf/perf_list.cpp index 751dcc8..112507f 100644 --- a/perf/perf_list.cpp +++ b/perf/perf_list.cpp @@ -23,7 +23,7 @@ using namespace boost::posix_time; //[perf_list_value_type //Iteration and element count defines -const int NumIter = 100; +const int NumIter = 4; const int NumElements = 50000; using namespace boost::intrusive; diff --git a/test/virtual_base_test.cpp b/test/virtual_base_test.cpp index 70a59db..b1b2592 100644 --- a/test/virtual_base_test.cpp +++ b/test/virtual_base_test.cpp @@ -35,7 +35,16 @@ class NonVirtualBase : public virtual VirtualBase , public virtual VirtualBase2 { - public: + protected: + NonVirtualBase() + : dummy() + {} + + //<- + const int *get_dummy() const { return dummy; } + //-> + + private: int dummy[10]; };