diff --git a/include/boost/intrusive/circular_slist_algorithms.hpp b/include/boost/intrusive/circular_slist_algorithms.hpp
index c39b3d0..fc3848e 100644
--- a/include/boost/intrusive/circular_slist_algorithms.hpp
+++ b/include/boost/intrusive/circular_slist_algorithms.hpp
@@ -172,18 +172,17 @@ class circular_slist_algorithms
static node_ptr get_previous_previous_node(const node_ptr & this_node)
{ return get_previous_previous_node(this_node, this_node); }
- //! Requires: this_node and prev_prev_init_node must be in the same circular list.
+ //! Requires: this_node and p must be in the same circular list.
//!
//! Effects: Returns the previous node of the previous node of this_node in the
- //! circular list starting. the search from prev_init_node. The first node checked
- //! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)).
+ //! circular list starting. the search from p. The first node checked
+ //! for equality is NodeTraits::get_next((NodeTraits::get_next(p)).
//!
//! Complexity: Linear to the number of elements in the circular list.
//!
//! Throws: Nothing.
- static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node)
+ static node_ptr get_previous_previous_node(node_ptr p, const node_ptr & this_node)
{
- node_ptr p = prev_prev_init_node;
node_ptr p_next = NodeTraits::get_next(p);
node_ptr p_next_next = NodeTraits::get_next(p_next);
while (this_node != p_next_next){
diff --git a/include/boost/intrusive/detail/avltree_node.hpp b/include/boost/intrusive/detail/avltree_node.hpp
index f9442eb..f6aefcb 100644
--- a/include/boost/intrusive/detail/avltree_node.hpp
+++ b/include/boost/intrusive/detail/avltree_node.hpp
@@ -71,24 +71,36 @@ struct default_avltree_node_traits_impl
static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; }
+ static node_ptr get_parent(const node_ptr & n)
+ { return n->parent_; }
+
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; }
+ static node_ptr get_left(const node_ptr & n)
+ { return n->left_; }
+
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; }
+ static node_ptr get_right(const node_ptr & n)
+ { return n->right_; }
+
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; }
static balance get_balance(const const_node_ptr & n)
{ return n->balance_; }
+ static balance get_balance(const node_ptr & n)
+ { return n->balance_; }
+
static void set_balance(const node_ptr & n, balance b)
{ n->balance_ = b; }
diff --git a/include/boost/intrusive/detail/common_slist_algorithms.hpp b/include/boost/intrusive/detail/common_slist_algorithms.hpp
index 942b35a..166f78d 100644
--- a/include/boost/intrusive/detail/common_slist_algorithms.hpp
+++ b/include/boost/intrusive/detail/common_slist_algorithms.hpp
@@ -31,9 +31,8 @@ class common_slist_algorithms
typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits;
- static node_ptr get_previous_node(const node_ptr & prev_init_node, const node_ptr & this_node)
+ static node_ptr get_previous_node(node_ptr p, const node_ptr & this_node)
{
- node_ptr p = prev_init_node;
for( node_ptr p_next
; this_node != (p_next = NodeTraits::get_next(p))
; p = p_next){
diff --git a/include/boost/intrusive/detail/list_node.hpp b/include/boost/intrusive/detail/list_node.hpp
index d25c3cd..32274e6 100644
--- a/include/boost/intrusive/detail/list_node.hpp
+++ b/include/boost/intrusive/detail/list_node.hpp
@@ -47,12 +47,18 @@ struct list_node_traits
static node_ptr get_previous(const const_node_ptr & n)
{ return n->prev_; }
+ static node_ptr get_previous(const node_ptr & n)
+ { return n->prev_; }
+
static void set_previous(const node_ptr & n, const node_ptr & prev)
{ n->prev_ = prev; }
static node_ptr get_next(const const_node_ptr & n)
{ return n->next_; }
+ static node_ptr get_next(const node_ptr & n)
+ { return n->next_; }
+
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next_ = next; }
};
diff --git a/include/boost/intrusive/detail/rbtree_node.hpp b/include/boost/intrusive/detail/rbtree_node.hpp
index 1e64f0f..92d9417 100644
--- a/include/boost/intrusive/detail/rbtree_node.hpp
+++ b/include/boost/intrusive/detail/rbtree_node.hpp
@@ -71,24 +71,36 @@ struct default_rbtree_node_traits_impl
static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; }
+ static node_ptr get_parent(const node_ptr & n)
+ { return n->parent_; }
+
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; }
+ static node_ptr get_left(const node_ptr & n)
+ { return n->left_; }
+
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; }
+ static node_ptr get_right(const node_ptr & n)
+ { return n->right_; }
+
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; }
static color get_color(const const_node_ptr & n)
{ return n->color_; }
+ static color get_color(const node_ptr & n)
+ { return n->color_; }
+
static void set_color(const node_ptr & n, color c)
{ n->color_ = c; }
@@ -117,24 +129,36 @@ struct compact_rbtree_node_traits_impl
static node_ptr get_parent(const const_node_ptr & n)
{ return ptr_bit::get_pointer(n->parent_); }
+ static node_ptr get_parent(const node_ptr & n)
+ { return ptr_bit::get_pointer(n->parent_); }
+
static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); }
static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; }
+ static node_ptr get_left(const node_ptr & n)
+ { return n->left_; }
+
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; }
+ static node_ptr get_right(const node_ptr & n)
+ { return n->right_; }
+
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; }
static color get_color(const const_node_ptr & n)
{ return (color)ptr_bit::get_bits(n->parent_); }
+ static color get_color(const node_ptr & n)
+ { return (color)ptr_bit::get_bits(n->parent_); }
+
static void set_color(const node_ptr & n, color c)
{ ptr_bit::set_bits(n->parent_, c != 0); }
diff --git a/include/boost/intrusive/detail/slist_node.hpp b/include/boost/intrusive/detail/slist_node.hpp
index d858d49..ee92919 100644
--- a/include/boost/intrusive/detail/slist_node.hpp
+++ b/include/boost/intrusive/detail/slist_node.hpp
@@ -45,6 +45,9 @@ struct slist_node_traits
static node_ptr get_next(const const_node_ptr & n)
{ return n->next_; }
+ static node_ptr get_next(const node_ptr & n)
+ { return n->next_; }
+
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next_ = next; }
};
diff --git a/include/boost/intrusive/detail/tree_algorithms.hpp b/include/boost/intrusive/detail/tree_algorithms.hpp
index c92d39b..acdedd9 100644
--- a/include/boost/intrusive/detail/tree_algorithms.hpp
+++ b/include/boost/intrusive/detail/tree_algorithms.hpp
@@ -485,15 +485,14 @@ class tree_algorithms
//! Complexity: Logarithmic to the size of the subtree.
//!
//! Throws: Nothing.
- static node_ptr minimum (const node_ptr & node)
+ static node_ptr minimum (node_ptr node)
{
- node_ptr p(node);
- for(node_ptr p_left = NodeTraits::get_left(p)
+ for(node_ptr p_left = NodeTraits::get_left(node)
;p_left
- ;p_left = NodeTraits::get_left(p)){
- p = p_left;
+ ;p_left = NodeTraits::get_left(node)){
+ node = p_left;
}
- return p;
+ return node;
}
//! Requires: 'node' is a node of a tree but not the header.
@@ -503,15 +502,14 @@ class tree_algorithms
//! Complexity: Logarithmic to the size of the subtree.
//!
//! Throws: Nothing.
- static node_ptr maximum(const node_ptr & node)
+ static node_ptr maximum(node_ptr node)
{
- node_ptr p(node);
- for(node_ptr p_right = NodeTraits::get_right(p)
+ for(node_ptr p_right = NodeTraits::get_right(node)
;p_right
- ;p_right = NodeTraits::get_right(p)){
- p = p_right;
+ ;p_right = NodeTraits::get_right(node)){
+ node = p_right;
}
- return p;
+ return node;
}
//! Requires: 'node' must not be part of any tree.
@@ -1171,14 +1169,13 @@ class tree_algorithms
//! Complexity: Logarithmic to the number of nodes in the tree.
//!
//! Throws: Nothing.
- static std::size_t depth(const const_node_ptr & node)
+ static std::size_t depth(const_node_ptr node)
{
- const_node_ptr p(node);
std::size_t depth = 0;
node_ptr p_parent;
- while(p != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(p))){
+ while(node != NodeTraits::get_parent(p_parent = NodeTraits::get_parent(node))){
++depth;
- p = p_parent;
+ node = p_parent;
}
return depth;
}
@@ -1295,12 +1292,10 @@ class tree_algorithms
}
template
- static void dispose_subtree(const node_ptr & node, Disposer disposer)
+ static void dispose_subtree(node_ptr x, Disposer disposer)
{
- node_ptr save;
- node_ptr x(node);
while (x){
- save = NodeTraits::get_left(x);
+ node_ptr save(NodeTraits::get_left(x));
if (save) {
// Right rotation
NodeTraits::set_left(x, NodeTraits::get_right(save));
diff --git a/include/boost/intrusive/detail/tree_node.hpp b/include/boost/intrusive/detail/tree_node.hpp
index c7cbb5a..aa3374e 100644
--- a/include/boost/intrusive/detail/tree_node.hpp
+++ b/include/boost/intrusive/detail/tree_node.hpp
@@ -44,18 +44,27 @@ struct tree_node_traits
static node_ptr get_parent(const const_node_ptr & n)
{ return n->parent_; }
+ static node_ptr get_parent(const node_ptr & n)
+ { return n->parent_; }
+
static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; }
static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; }
+ static node_ptr get_left(const node_ptr & n)
+ { return n->left_; }
+
static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; }
static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; }
+ static node_ptr get_right(const node_ptr & n)
+ { return n->right_; }
+
static void set_right(const node_ptr & n, const node_ptr & r)
{ n->right_ = r; }
};
diff --git a/include/boost/intrusive/rbtree_algorithms.hpp b/include/boost/intrusive/rbtree_algorithms.hpp
index 451a550..fc28630 100644
--- a/include/boost/intrusive/rbtree_algorithms.hpp
+++ b/include/boost/intrusive/rbtree_algorithms.hpp
@@ -805,26 +805,26 @@ class rbtree_algorithms
// NodeTraits::get_parent(NodeTraits::get_parent(p)) == p;
}
- static void rebalance_after_erasure(const node_ptr & header, const node_ptr &xnode, const node_ptr &xnode_parent)
+ static void rebalance_after_erasure(const node_ptr & header, node_ptr x, node_ptr x_parent)
{
- node_ptr x(xnode), x_parent(xnode_parent);
- while(x != NodeTraits::get_parent(header) && (x == node_ptr() || NodeTraits::get_color(x) == NodeTraits::black())){
+ while(x != NodeTraits::get_parent(header) && (!x || NodeTraits::get_color(x) == NodeTraits::black())){
if(x == NodeTraits::get_left(x_parent)){
node_ptr w = NodeTraits::get_right(x_parent);
+ BOOST_ASSERT(w);
if(NodeTraits::get_color(w) == NodeTraits::red()){
NodeTraits::set_color(w, NodeTraits::black());
NodeTraits::set_color(x_parent, NodeTraits::red());
tree_algorithms::rotate_left(x_parent, header);
w = NodeTraits::get_right(x_parent);
}
- if((NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
- (NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){
+ if((!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()) &&
+ (!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){
NodeTraits::set_color(w, NodeTraits::red());
x = x_parent;
x_parent = NodeTraits::get_parent(x_parent);
}
else {
- if(NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
+ if(!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()){
NodeTraits::set_color(NodeTraits::get_left(w), NodeTraits::black());
NodeTraits::set_color(w, NodeTraits::red());
tree_algorithms::rotate_right(w, header);
@@ -847,14 +847,14 @@ class rbtree_algorithms
tree_algorithms::rotate_right(x_parent, header);
w = NodeTraits::get_left(x_parent);
}
- if((NodeTraits::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
- (NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){
+ if((!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black()) &&
+ (!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){
NodeTraits::set_color(w, NodeTraits::red());
x = x_parent;
x_parent = NodeTraits::get_parent(x_parent);
}
else {
- if(NodeTraits::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
+ if(!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black()){
NodeTraits::set_color(NodeTraits::get_right(w), NodeTraits::black());
NodeTraits::set_color(w, NodeTraits::red());
tree_algorithms::rotate_left(w, header);
@@ -874,9 +874,8 @@ class rbtree_algorithms
}
- static void rebalance_after_insertion(const node_ptr & header, const node_ptr &pnode)
+ static void rebalance_after_insertion(const node_ptr & header, node_ptr p)
{
- node_ptr p(pnode);
NodeTraits::set_color(p, NodeTraits::red());
while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(p)) == NodeTraits::red()){
node_ptr p_parent(NodeTraits::get_parent(p));