From c0377800b214952a4d1bbf394c450a370abbf37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 23 Aug 2022 07:58:45 +0200 Subject: [PATCH] Fix -Wshadow warnings in GCC renaming "node" arguments with "n". --- .../boost/intrusive/avltree_algorithms.hpp | 18 ++-- include/boost/intrusive/bstree_algorithms.hpp | 90 +++++++++---------- .../detail/any_node_and_algorithms.hpp | 16 ++-- .../detail/bstree_algorithms_base.hpp | 75 ++++++++-------- include/boost/intrusive/rbtree_algorithms.hpp | 14 +-- include/boost/intrusive/sgtree_algorithms.hpp | 10 +-- .../boost/intrusive/splaytree_algorithms.hpp | 20 +++-- include/boost/intrusive/treap_algorithms.hpp | 14 +-- 8 files changed, 129 insertions(+), 128 deletions(-) diff --git a/include/boost/intrusive/avltree_algorithms.hpp b/include/boost/intrusive/avltree_algorithms.hpp index 48b028c..0fd158d 100644 --- a/include/boost/intrusive/avltree_algorithms.hpp +++ b/include/boost/intrusive/avltree_algorithms.hpp @@ -218,13 +218,13 @@ class avltree_algorithms } //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) - static void unlink(node_ptr node) BOOST_NOEXCEPT + static void unlink(node_ptr n) BOOST_NOEXCEPT { - node_ptr x = NodeTraits::get_parent(node); + node_ptr x = NodeTraits::get_parent(n); if(x){ while(!is_header(x)) x = NodeTraits::get_parent(x); - erase(x, node); + erase(x, n); } } @@ -233,22 +233,22 @@ class avltree_algorithms static node_ptr unlink_leftmost_without_rebalance(node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const_node_ptr) - static bool unique(const_node_ptr node) BOOST_NOEXCEPT; + static bool unique(const_node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::size(const_node_ptr) static std::size_t size(const_node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(node_ptr) - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(node_ptr) - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) - static void init(node_ptr node) BOOST_NOEXCEPT; + static void init(node_ptr n) BOOST_NOEXCEPT; #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED - //! Requires: node must not be part of any tree. + //! Requires: header must not be part of any tree. //! //! Effects: Initializes the header to represent an empty tree. //! unique(header) == true. @@ -257,7 +257,7 @@ class avltree_algorithms //! //! Throws: Nothing. //! - //! Nodes: If node is inserted in a tree, this function corrupts the tree. + //! Nodes: If header is inserted in a tree, this function corrupts the tree. static void init_header(node_ptr header) BOOST_NOEXCEPT { bstree_algo::init_header(header); diff --git a/include/boost/intrusive/bstree_algorithms.hpp b/include/boost/intrusive/bstree_algorithms.hpp index ac8a088..5113a58 100644 --- a/include/boost/intrusive/bstree_algorithms.hpp +++ b/include/boost/intrusive/bstree_algorithms.hpp @@ -239,7 +239,7 @@ class bstree_algorithms : public bstree_algorithms_base return p ? p : detail::uncast(header); } - //! Requires: 'node' is a node of the tree or a node initialized + //! Requires: 'n' is a node of the tree or a node initialized //! by init(...) or init_node. //! //! Effects: Returns true if the node is initialized by init() or init_node(). @@ -247,18 +247,18 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Constant time. //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr node) BOOST_NOEXCEPT - { return !NodeTraits::get_parent(node); } + BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr n) BOOST_NOEXCEPT + { return !NodeTraits::get_parent(n); } #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) - //! Requires: 'node' is a node of the tree or a header node. + //! Requires: 'n' is a node of the tree or a header node. //! //! Effects: Returns the header of the tree. //! //! Complexity: Logarithmic. //! //! Throws: Nothing. - static node_ptr get_header(const_node_ptr node); + static node_ptr get_header(const_node_ptr n); #endif //! Requires: node1 and node2 can't be header nodes @@ -518,44 +518,44 @@ class bstree_algorithms : public bstree_algorithms_base } #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) - //! Requires: 'node' is a node from the tree except the header. + //! Requires: 'n' is a node from the tree except the header. //! //! Effects: Returns the next node of the tree. //! //! Complexity: Average constant time. //! //! Throws: Nothing. - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; - //! Requires: 'node' is a node from the tree except the leftmost node. + //! Requires: 'n' is a node from the tree except the leftmost node. //! //! Effects: Returns the previous node of the tree. //! //! Complexity: Average constant time. //! //! Throws: Nothing. - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; - //! Requires: 'node' is a node of a tree but not the header. + //! Requires: 'n' is a node of a tree but not the header. //! //! Effects: Returns the minimum node of the subtree starting at p. //! //! Complexity: Logarithmic to the size of the subtree. //! //! Throws: Nothing. - static node_ptr minimum(node_ptr node); + static node_ptr minimum(node_ptr n); - //! Requires: 'node' is a node of a tree but not the header. + //! Requires: 'n' is a node of a tree but not the header. //! //! Effects: Returns the maximum node of the subtree starting at p. //! //! Complexity: Logarithmic to the size of the subtree. //! //! Throws: Nothing. - static node_ptr maximum(node_ptr node); + static node_ptr maximum(node_ptr n); #endif - //! Requires: 'node' must not be part of any tree. + //! Requires: 'n' must not be part of any tree. //! //! Effects: After the function unique(node) == true. //! @@ -564,11 +564,11 @@ class bstree_algorithms : public bstree_algorithms_base //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. - static void init(node_ptr node) BOOST_NOEXCEPT + static void init(node_ptr n) BOOST_NOEXCEPT { - NodeTraits::set_parent(node, node_ptr()); - NodeTraits::set_left(node, node_ptr()); - NodeTraits::set_right(node, node_ptr()); + NodeTraits::set_parent(n, node_ptr()); + NodeTraits::set_left(n, node_ptr()); + NodeTraits::set_right(n, node_ptr()); } //! Effects: Returns true if node is in the same state as if called init(node) @@ -576,14 +576,14 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Constant. //! //! Throws: Nothing. - static bool inited(const_node_ptr node) + static bool inited(const_node_ptr n) { - return !NodeTraits::get_parent(node) && - !NodeTraits::get_left(node) && - !NodeTraits::get_right(node) ; + return !NodeTraits::get_parent(n) && + !NodeTraits::get_left(n) && + !NodeTraits::get_right(n) ; } - //! Requires: node must not be part of any tree. + //! Requires: header must not be part of any tree. //! //! Effects: Initializes the header to represent an empty tree. //! unique(header) == true. @@ -592,7 +592,7 @@ class bstree_algorithms : public bstree_algorithms_base //! //! Throws: Nothing. //! - //! Nodes: If node is inserted in a tree, this function corrupts the tree. + //! Nodes: If header is inserted in a tree, this function corrupts the tree. static void init_header(node_ptr header) BOOST_NOEXCEPT { NodeTraits::set_parent(header, node_ptr()); @@ -664,9 +664,9 @@ class bstree_algorithms : public bstree_algorithms_base return leftmost; } - //! Requires: node is a node of the tree but it's not the header. + //! Requires: 'header' the header of the tree. //! - //! Effects: Returns the number of nodes of the subtree. + //! Effects: Returns the number of nodes of the tree. //! //! Complexity: Linear time. //! @@ -1259,7 +1259,7 @@ class bstree_algorithms : public bstree_algorithms_base insert_commit(header, new_node, commit_data); } - //! Requires: 'node' can't be a header node. + //! Requires: 'n' can't be a header node. //! //! Effects: Calculates the depth of a node: the depth of a //! node is the length (number of edges) of the path from the root @@ -1268,13 +1268,13 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Logarithmic to the number of nodes in the tree. //! //! Throws: Nothing. - static std::size_t depth(const_node_ptr node) BOOST_NOEXCEPT + static std::size_t depth(const_node_ptr n) BOOST_NOEXCEPT { std::size_t depth = 0; node_ptr p_parent; - while(node != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(node))){ + while(n != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(n))){ ++depth; - node = p_parent; + n = p_parent; } return depth; } @@ -1365,20 +1365,20 @@ class bstree_algorithms : public bstree_algorithms_base transfer_equal(header1, comp, header2, z, ignored); } - //! Requires: node is a tree node but not the header. + //! Requires: 'n' is a tree node but not the header. //! //! Effects: Unlinks the node and rebalances the tree. //! //! Complexity: Average complexity is constant time. //! //! Throws: Nothing. - static void unlink(node_ptr node) BOOST_NOEXCEPT + static void unlink(node_ptr n) BOOST_NOEXCEPT { - node_ptr x = NodeTraits::get_parent(node); + node_ptr x = NodeTraits::get_parent(n); if(x){ while(!base_type::is_header(x)) x = NodeTraits::get_parent(x); - erase(x, node); + erase(x, n); } } @@ -1585,7 +1585,7 @@ class bstree_algorithms : public bstree_algorithms_base info.x_parent = x_parent; } - //! Requires: node is a node of the tree but it's not the header. + //! Requires: 'subtree' is a node of the tree but it's not the header. //! //! Effects: Returns the number of nodes of the subtree. //! @@ -1916,10 +1916,10 @@ class bstree_algorithms : public bstree_algorithms_base //! Complexity: Logarithmic. //! //! Throws: Nothing. - static node_ptr get_root(node_ptr node) BOOST_NOEXCEPT + static node_ptr get_root(node_ptr n) BOOST_NOEXCEPT { - BOOST_INTRUSIVE_INVARIANT_ASSERT((!inited(node))); - node_ptr x = NodeTraits::get_parent(node); + BOOST_INTRUSIVE_INVARIANT_ASSERT((!inited(n))); + node_ptr x = NodeTraits::get_parent(n); if(x){ while(!base_type::is_header(x)){ x = NodeTraits::get_parent(x); @@ -1927,7 +1927,7 @@ class bstree_algorithms : public bstree_algorithms_base return x; } else{ - return node; + return n; } } @@ -2059,23 +2059,23 @@ class bstree_algorithms : public bstree_algorithms_base } template - static void check_subtree(const_node_ptr node, Checker checker, typename Checker::return_type& check_return) + static void check_subtree(const_node_ptr n, Checker checker, typename Checker::return_type& check_return) { - const_node_ptr left = NodeTraits::get_left(node); - const_node_ptr right = NodeTraits::get_right(node); + const_node_ptr left = NodeTraits::get_left(n); + const_node_ptr right = NodeTraits::get_right(n); typename Checker::return_type check_return_left; typename Checker::return_type check_return_right; if (left) { - BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_parent(left) == node); + BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_parent(left) == n); check_subtree(left, checker, check_return_left); } if (right) { - BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_parent(right) == node); + BOOST_INTRUSIVE_INVARIANT_ASSERT(NodeTraits::get_parent(right) == n); check_subtree(right, checker, check_return_right); } - checker(node, check_return_left, check_return_right, check_return); + checker(n, check_return_left, check_return_right, check_return); } }; diff --git a/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/include/boost/intrusive/detail/any_node_and_algorithms.hpp index 36a03d5..7949eec 100644 --- a/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -243,7 +243,7 @@ class any_algorithms typedef typename node::const_node_ptr const_node_ptr; typedef any_node_traits node_traits; - //! Requires: node must not be part of any tree. + //! Requires: 'n' must not be part of any tree. //! //! Effects: After the function unique(node) == true. //! @@ -252,19 +252,19 @@ class any_algorithms //! Throws: Nothing. //! //! Nodes: If node is inserted in a tree, this function corrupts the tree. - BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr node) BOOST_NOEXCEPT - { node->node_ptr_1 = node_ptr(); }; + BOOST_INTRUSIVE_FORCEINLINE static void init(node_ptr n) BOOST_NOEXCEPT + { n->node_ptr_1 = node_ptr(); }; - //! Effects: Returns true if node is in the same state as if called init(node) + //! Effects: Returns true if 'n' is in the same state as if called init(node) //! //! Complexity: Constant. //! //! Throws: Nothing. - BOOST_INTRUSIVE_FORCEINLINE static bool inited(const_node_ptr node) - { return !node->node_ptr_1; }; + BOOST_INTRUSIVE_FORCEINLINE static bool inited(const_node_ptr n) + { return !n->node_ptr_1; }; - BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr node) BOOST_NOEXCEPT - { return !node->node_ptr_1; } + BOOST_INTRUSIVE_FORCEINLINE static bool unique(const_node_ptr n) BOOST_NOEXCEPT + { return !n->node_ptr_1; } static void unlink(node_ptr) { diff --git a/include/boost/intrusive/detail/bstree_algorithms_base.hpp b/include/boost/intrusive/detail/bstree_algorithms_base.hpp index 023d870..1dbd491 100644 --- a/include/boost/intrusive/detail/bstree_algorithms_base.hpp +++ b/include/boost/intrusive/detail/bstree_algorithms_base.hpp @@ -35,21 +35,20 @@ class bstree_algorithms_base typedef typename NodeTraits::node_ptr node_ptr; typedef typename NodeTraits::const_node_ptr const_node_ptr; - //! Requires: 'node' is a node from the tree except the header. + //! Requires: 'n' is a node from the tree except the header. //! //! Effects: Returns the next node of the tree. //! //! Complexity: Average constant time. //! //! Throws: Nothing. - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT { - node_ptr const n_right(NodeTraits::get_right(node)); + node_ptr const n_right(NodeTraits::get_right(n)); if(n_right){ return minimum(n_right); } else { - node_ptr n(node); node_ptr p(NodeTraits::get_parent(n)); while(n == NodeTraits::get_right(p)){ n = p; @@ -59,23 +58,23 @@ class bstree_algorithms_base } } - //! Requires: 'node' is a node from the tree except the leftmost node. + //! Requires: 'n' is a node from the tree except the leftmost node. //! //! Effects: Returns the previous node of the tree. //! //! Complexity: Average constant time. //! //! Throws: Nothing. - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT { - if(is_header(node)){ - return NodeTraits::get_right(node); + if(is_header(n)){ + return NodeTraits::get_right(n); } - else if(NodeTraits::get_left(node)){ - return maximum(NodeTraits::get_left(node)); + else if(NodeTraits::get_left(n)){ + return maximum(NodeTraits::get_left(n)); } else { - node_ptr p(node); + node_ptr p(n); node_ptr x = NodeTraits::get_parent(p); while(p == NodeTraits::get_left(x)){ p = x; @@ -85,38 +84,38 @@ class bstree_algorithms_base } } - //! Requires: 'node' is a node of a tree but not the header. + //! Requires: 'n' is a node of a tree but not the header. //! //! Effects: Returns the minimum node of the subtree starting at p. //! //! Complexity: Logarithmic to the size of the subtree. //! //! Throws: Nothing. - static node_ptr minimum(node_ptr node) + static node_ptr minimum(node_ptr n) { - for(node_ptr p_left = NodeTraits::get_left(node) + for(node_ptr p_left = NodeTraits::get_left(n) ;p_left - ;p_left = NodeTraits::get_left(node)){ - node = p_left; + ;p_left = NodeTraits::get_left(n)){ + n = p_left; } - return node; + return n; } - //! Requires: 'node' is a node of a tree but not the header. + //! Requires: 'n' is a node of a tree but not the header. //! //! Effects: Returns the maximum node of the subtree starting at p. //! //! Complexity: Logarithmic to the size of the subtree. //! //! Throws: Nothing. - static node_ptr maximum(node_ptr node) + static node_ptr maximum(node_ptr n) { - for(node_ptr p_right = NodeTraits::get_right(node) + for(node_ptr p_right = NodeTraits::get_right(n) ;p_right - ;p_right = NodeTraits::get_right(node)){ - node = p_right; + ;p_right = NodeTraits::get_right(n)){ + n = p_right; } - return node; + return n; } //! Requires: p is a node of a tree. @@ -143,37 +142,37 @@ class bstree_algorithms_base return false; } - //! Requires: 'node' is a node of the tree or a header node. + //! Requires: 'n' is a node of the tree or a header node. //! //! Effects: Returns the header of the tree. //! //! Complexity: Logarithmic. //! //! Throws: Nothing. - static node_ptr get_header(const_node_ptr node) + static node_ptr get_header(const_node_ptr n) { - node_ptr n(detail::uncast(node)); - node_ptr p(NodeTraits::get_parent(node)); - //If p is null, then n is the header of an empty tree + node_ptr nn(detail::uncast(n)); + node_ptr p(NodeTraits::get_parent(n)); + //If p is null, then nn is the header of an empty tree if(p){ - //Non-empty tree, check if n is neither root nor header + //Non-empty tree, check if nn is neither root nor header node_ptr pp(NodeTraits::get_parent(p)); - //If granparent is not equal to n, then n is neither root nor header, + //If granparent is not equal to nn, then nn is neither root nor header, //the try the fast path - if(n != pp){ + if(nn != pp){ do{ - n = p; + nn = p; p = pp; pp = NodeTraits::get_parent(pp); - }while(n != pp); - n = p; + }while(nn != pp); + nn = p; } - //Check if n is root or header when size() > 0 - else if(!bstree_algorithms_base::is_header(n)){ - n = p; + //Check if nn is root or header when size() > 0 + else if(!bstree_algorithms_base::is_header(nn)){ + nn = p; } } - return n; + return nn; } }; diff --git a/include/boost/intrusive/rbtree_algorithms.hpp b/include/boost/intrusive/rbtree_algorithms.hpp index 4457dc6..bbb3f0f 100644 --- a/include/boost/intrusive/rbtree_algorithms.hpp +++ b/include/boost/intrusive/rbtree_algorithms.hpp @@ -242,13 +242,13 @@ class rbtree_algorithms } //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) - static void unlink(node_ptr node) BOOST_NOEXCEPT + static void unlink(node_ptr n) BOOST_NOEXCEPT { - node_ptr x = NodeTraits::get_parent(node); + node_ptr x = NodeTraits::get_parent(n); if(x){ while(!is_header(x)) x = NodeTraits::get_parent(x); - erase(x, node); + erase(x, n); } } @@ -257,19 +257,19 @@ class rbtree_algorithms static node_ptr unlink_leftmost_without_rebalance(node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const_node_ptr) - static bool unique(const_node_ptr node) BOOST_NOEXCEPT; + static bool unique(const_node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::size(const_node_ptr) static std::size_t size(const_node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(const_node_ptr) - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(const_node_ptr) - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) - static void init(node_ptr node) BOOST_NOEXCEPT; + static void init(node_ptr n) BOOST_NOEXCEPT; #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) diff --git a/include/boost/intrusive/sgtree_algorithms.hpp b/include/boost/intrusive/sgtree_algorithms.hpp index 27add03..726dbb9 100644 --- a/include/boost/intrusive/sgtree_algorithms.hpp +++ b/include/boost/intrusive/sgtree_algorithms.hpp @@ -110,25 +110,25 @@ class sgtree_algorithms static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) BOOST_NOEXCEPT; //Unlink is not possible since tree metadata is needed to update the tree - //!static void unlink(node_ptr node) BOOST_NOEXCEPT; + //!static void unlink(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance static node_ptr unlink_leftmost_without_rebalance(node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const_node_ptr) - static bool unique(const_node_ptr node) BOOST_NOEXCEPT; + static bool unique(const_node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::size(const_node_ptr) static std::size_t size(const_node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(node_ptr) - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(node_ptr) - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) - static void init(node_ptr node) BOOST_NOEXCEPT; + static void init(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) static void init_header(node_ptr header) BOOST_NOEXCEPT; diff --git a/include/boost/intrusive/splaytree_algorithms.hpp b/include/boost/intrusive/splaytree_algorithms.hpp index b36fddd..bef440a 100644 --- a/include/boost/intrusive/splaytree_algorithms.hpp +++ b/include/boost/intrusive/splaytree_algorithms.hpp @@ -200,25 +200,25 @@ class splaytree_algorithms static void replace_node(node_ptr node_to_be_replaced, node_ptr header, node_ptr new_node) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) - static void unlink(node_ptr node) BOOST_NOEXCEPT; + static void unlink(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unlink_leftmost_without_rebalance static node_ptr unlink_leftmost_without_rebalance(node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const_node_ptr) - static bool unique(const_node_ptr node) BOOST_NOEXCEPT; + static bool unique(const_node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::size(const_node_ptr) static std::size_t size(const_node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(node_ptr) - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(node_ptr) - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) - static void init(node_ptr node) BOOST_NOEXCEPT; + static void init(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) static void init_header(node_ptr header) BOOST_NOEXCEPT; @@ -521,8 +521,8 @@ class splaytree_algorithms #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow - static void splay_up(node_ptr node, node_ptr header) BOOST_NOEXCEPT - { priv_splay_up(node, header); } + static void splay_up(node_ptr n, node_ptr header) BOOST_NOEXCEPT + { priv_splay_up(n, header); } // top-down splay | complexity : logarithmic | exception : strong, note A template @@ -535,12 +535,14 @@ class splaytree_algorithms // bottom-up splay, use data_ as parent for n | complexity : logarithmic | exception : nothrow template - static void priv_splay_up(node_ptr node, node_ptr header) BOOST_NOEXCEPT + static void priv_splay_up(node_ptr n, node_ptr header) BOOST_NOEXCEPT { // 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 // where there are many equal elements at the end - node_ptr n((node == header) ? NodeTraits::get_right(header) : node); + if(n == header) + n = NodeTraits::get_right(header); + node_ptr t(header); if( n == t ) return; diff --git a/include/boost/intrusive/treap_algorithms.hpp b/include/boost/intrusive/treap_algorithms.hpp index f2150c1..a8ddee6 100644 --- a/include/boost/intrusive/treap_algorithms.hpp +++ b/include/boost/intrusive/treap_algorithms.hpp @@ -205,13 +205,13 @@ class treap_algorithms //! @copydoc ::boost::intrusive::bstree_algorithms::unlink(node_ptr) template - static void unlink(node_ptr node, NodePtrPriorityCompare pcomp) + static void unlink(node_ptr n, NodePtrPriorityCompare pcomp) { - node_ptr x = NodeTraits::get_parent(node); + node_ptr x = NodeTraits::get_parent(n); if(x){ while(!bstree_algo::is_header(x)) x = NodeTraits::get_parent(x); - erase(x, node, pcomp); + erase(x, n, pcomp); } } @@ -220,19 +220,19 @@ class treap_algorithms static node_ptr unlink_leftmost_without_rebalance(node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::unique(const_node_ptr) - static bool unique(const_node_ptr node) BOOST_NOEXCEPT; + static bool unique(const_node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::size(const_node_ptr) static std::size_t size(const_node_ptr header) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::next_node(node_ptr) - static node_ptr next_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr next_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::prev_node(node_ptr) - static node_ptr prev_node(node_ptr node) BOOST_NOEXCEPT; + static node_ptr prev_node(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init(node_ptr) - static void init(node_ptr node) BOOST_NOEXCEPT; + static void init(node_ptr n) BOOST_NOEXCEPT; //! @copydoc ::boost::intrusive::bstree_algorithms::init_header(node_ptr) static void init_header(node_ptr header) BOOST_NOEXCEPT;