Merge from trunk

[SVN r80689]
This commit is contained in:
Ion Gaztañaga
2012-09-24 12:17:34 +00:00
parent 1a3bb83a22
commit ec31a6b75b
20 changed files with 340 additions and 415 deletions

View File

@@ -89,7 +89,7 @@ class avltree_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -172,18 +172,17 @@ class circular_slist_algorithms
static node_ptr get_previous_previous_node(const node_ptr & this_node) static node_ptr get_previous_previous_node(const node_ptr & this_node)
{ return get_previous_previous_node(this_node, this_node); } { return get_previous_previous_node(this_node, this_node); }
//! <b>Requires</b>: this_node and prev_prev_init_node must be in the same circular list. //! <b>Requires</b>: this_node and p must be in the same circular list.
//! //!
//! <b>Effects</b>: Returns the previous node of the previous node of this_node in the //! <b>Effects</b>: 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 //! circular list starting. the search from p. The first node checked
//! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)). //! for equality is NodeTraits::get_next((NodeTraits::get_next(p)).
//! //!
//! <b>Complexity</b>: Linear to the number of elements in the circular list. //! <b>Complexity</b>: Linear to the number of elements in the circular list.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: 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 = NodeTraits::get_next(p);
node_ptr p_next_next = NodeTraits::get_next(p_next); node_ptr p_next_next = NodeTraits::get_next(p_next);
while (this_node != p_next_next){ while (this_node != p_next_next){

View File

@@ -68,19 +68,28 @@ struct default_avltree_node_traits_impl
typedef typename node::balance balance; typedef typename node::balance balance;
static const node_ptr & get_parent(const const_node_ptr & n) 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_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static const node_ptr & get_left(const const_node_ptr & n) 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_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static const node_ptr & get_right(const const_node_ptr & n) 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_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) static void set_right(const node_ptr & n, const node_ptr & r)
@@ -89,6 +98,9 @@ struct default_avltree_node_traits_impl
static balance get_balance(const const_node_ptr & n) static balance get_balance(const const_node_ptr & n)
{ return n->balance_; } { return n->balance_; }
static balance get_balance(const node_ptr & n)
{ return n->balance_; }
static void set_balance(const node_ptr & n, balance b) static void set_balance(const node_ptr & n, balance b)
{ n->balance_ = b; } { n->balance_ = b; }
@@ -125,13 +137,13 @@ struct compact_avltree_node_traits_impl
static void set_parent(const node_ptr & n, const node_ptr & p) static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); } { ptr_bit::set_pointer(n->parent_, p); }
static const node_ptr & get_left(const const_node_ptr & n) static node_ptr get_left(const const_node_ptr & n)
{ return n->left_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static const node_ptr & get_right(const const_node_ptr & n) static node_ptr get_right(const const_node_ptr & n)
{ return n->right_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) static void set_right(const node_ptr & n, const node_ptr & r)

View File

@@ -31,9 +31,8 @@ class common_slist_algorithms
typedef typename NodeTraits::const_node_ptr const_node_ptr; typedef typename NodeTraits::const_node_ptr const_node_ptr;
typedef NodeTraits node_traits; 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 for( node_ptr p_next
; this_node != (p_next = NodeTraits::get_next(p)) ; this_node != (p_next = NodeTraits::get_next(p))
; p = p_next){ ; p = p_next){

View File

@@ -44,13 +44,19 @@ struct list_node_traits
typedef typename pointer_traits typedef typename pointer_traits
<VoidPointer>:: template rebind_pointer<const node>::type const_node_ptr; <VoidPointer>:: template rebind_pointer<const node>::type const_node_ptr;
static const node_ptr &get_previous(const const_node_ptr & n) 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_; } { return n->prev_; }
static void set_previous(const node_ptr & n, const node_ptr & prev) static void set_previous(const node_ptr & n, const node_ptr & prev)
{ n->prev_ = prev; } { n->prev_ = prev; }
static const node_ptr &get_next(const const_node_ptr & n) 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_; } { return n->next_; }
static void set_next(const node_ptr & n, const node_ptr & next) static void set_next(const node_ptr & n, const node_ptr & next)

View File

@@ -68,19 +68,28 @@ struct default_rbtree_node_traits_impl
typedef typename node::color color; typedef typename node::color color;
static const node_ptr & get_parent(const const_node_ptr & n) 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_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static const node_ptr & get_left(const const_node_ptr & n) 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_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static const node_ptr & get_right(const const_node_ptr & n) 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_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) static void set_right(const node_ptr & n, const node_ptr & r)
@@ -89,6 +98,9 @@ struct default_rbtree_node_traits_impl
static color get_color(const const_node_ptr & n) static color get_color(const const_node_ptr & n)
{ return n->color_; } { return n->color_; }
static color get_color(const node_ptr & n)
{ return n->color_; }
static void set_color(const node_ptr & n, color c) static void set_color(const node_ptr & n, color c)
{ n->color_ = c; } { n->color_ = c; }
@@ -117,16 +129,25 @@ struct compact_rbtree_node_traits_impl
static node_ptr get_parent(const const_node_ptr & n) static node_ptr get_parent(const const_node_ptr & n)
{ return ptr_bit::get_pointer(n->parent_); } { 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) static void set_parent(const node_ptr & n, const node_ptr & p)
{ ptr_bit::set_pointer(n->parent_, p); } { ptr_bit::set_pointer(n->parent_, p); }
static const node_ptr & get_left(const const_node_ptr & n) 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_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static const node_ptr & get_right(const const_node_ptr & n) 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_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) static void set_right(const node_ptr & n, const node_ptr & r)
@@ -135,6 +156,9 @@ struct compact_rbtree_node_traits_impl
static color get_color(const const_node_ptr & n) static color get_color(const const_node_ptr & n)
{ return (color)ptr_bit::get_bits(n->parent_); } { 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) static void set_color(const node_ptr & n, color c)
{ ptr_bit::set_bits(n->parent_, c != 0); } { ptr_bit::set_bits(n->parent_, c != 0); }

View File

@@ -42,7 +42,10 @@ struct slist_node_traits
typedef typename pointer_traits typedef typename pointer_traits
<VoidPointer>::template rebind_pointer<const node>::type const_node_ptr; <VoidPointer>::template rebind_pointer<const node>::type const_node_ptr;
static const node_ptr &get_next(const const_node_ptr & n) 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_; } { return n->next_; }
static void set_next(const node_ptr & n, const node_ptr & next) static void set_next(const node_ptr & n, const node_ptr & next)

View File

@@ -485,15 +485,14 @@ class tree_algorithms
//! <b>Complexity</b>: Logarithmic to the size of the subtree. //! <b>Complexity</b>: Logarithmic to the size of the subtree.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: 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(node)
for(node_ptr p_left = NodeTraits::get_left(p)
;p_left ;p_left
;p_left = NodeTraits::get_left(p)){ ;p_left = NodeTraits::get_left(node)){
p = p_left; node = p_left;
} }
return p; return node;
} }
//! <b>Requires</b>: 'node' is a node of a tree but not the header. //! <b>Requires</b>: 'node' is a node of a tree but not the header.
@@ -503,15 +502,14 @@ class tree_algorithms
//! <b>Complexity</b>: Logarithmic to the size of the subtree. //! <b>Complexity</b>: Logarithmic to the size of the subtree.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: 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(node)
for(node_ptr p_right = NodeTraits::get_right(p)
;p_right ;p_right
;p_right = NodeTraits::get_right(p)){ ;p_right = NodeTraits::get_right(node)){
p = p_right; node = p_right;
} }
return p; return node;
} }
//! <b>Requires</b>: 'node' must not be part of any tree. //! <b>Requires</b>: 'node' must not be part of any tree.
@@ -1171,14 +1169,13 @@ class tree_algorithms
//! <b>Complexity</b>: Logarithmic to the number of nodes in the tree. //! <b>Complexity</b>: Logarithmic to the number of nodes in the tree.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: 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; std::size_t depth = 0;
node_ptr p_parent; 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; ++depth;
p = p_parent; node = p_parent;
} }
return depth; return depth;
} }
@@ -1295,12 +1292,10 @@ class tree_algorithms
} }
template<class Disposer> template<class Disposer>
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){ while (x){
save = NodeTraits::get_left(x); node_ptr save(NodeTraits::get_left(x));
if (save) { if (save) {
// Right rotation // Right rotation
NodeTraits::set_left(x, NodeTraits::get_right(save)); NodeTraits::set_left(x, NodeTraits::get_right(save));

View File

@@ -41,19 +41,28 @@ struct tree_node_traits
typedef typename pointer_traits<VoidPointer>::template typedef typename pointer_traits<VoidPointer>::template
rebind_pointer<const node>::type const_node_ptr; rebind_pointer<const node>::type const_node_ptr;
static const node_ptr & get_parent(const const_node_ptr & n) 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_; } { return n->parent_; }
static void set_parent(const node_ptr & n, const node_ptr & p) static void set_parent(const node_ptr & n, const node_ptr & p)
{ n->parent_ = p; } { n->parent_ = p; }
static const node_ptr & get_left(const const_node_ptr & n) 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_; } { return n->left_; }
static void set_left(const node_ptr & n, const node_ptr & l) static void set_left(const node_ptr & n, const node_ptr & l)
{ n->left_ = l; } { n->left_ = l; }
static const node_ptr & get_right(const const_node_ptr & n) 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_; } { return n->right_; }
static void set_right(const node_ptr & n, const node_ptr & r) static void set_right(const node_ptr & n, const node_ptr & r)

View File

@@ -41,64 +41,29 @@ struct internal_member_value_traits
static const bool value = sizeof(test<T>(0)) == sizeof(detail::two); static const bool value = sizeof(test<T>(0)) == sizeof(detail::two);
}; };
template <class T> #define BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(TRAITS_PREFIX, TYPEDEF_TO_FIND) \
struct internal_base_hook_bool template <class T>\
{ struct TRAITS_PREFIX##_bool\
template<bool Add> {\
struct two_or_three {one _[2 + Add];}; template<bool Add>\
template <class U> static one test(...); struct two_or_three {one _[2 + Add];};\
template <class U> static two_or_three<U::boost_intrusive_tags::is_base_hook> test (int); template <class U> static one test(...);\
static const std::size_t value = sizeof(test<T>(0)); template <class U> static two_or_three<U::TYPEDEF_TO_FIND> test (int);\
}; static const std::size_t value = sizeof(test<T>(0));\
};\
\
template <class T>\
struct TRAITS_PREFIX##_bool_is_true\
{\
static const bool value = TRAITS_PREFIX##_bool<T>::value > sizeof(one)*2;\
};\
//
template <class T> BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_base_hook, boost_intrusive_tags::is_base_hook)
struct internal_base_hook_bool_is_true BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(internal_any_hook, is_any_hook)
{ BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_value_traits, external_value_traits)
static const bool value = internal_base_hook_bool<T>::value > sizeof(one)*2; BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(external_bucket_traits, external_bucket_traits)
}; BOOST_INTRUSIVE_INTERNAL_STATIC_BOOL_IS_TRUE(resizable, resizable)
template <class T>
struct internal_any_hook_bool
{
template<bool Add>
struct two_or_three {one _[2 + Add];};
template <class U> static one test(...);
template <class U> static two_or_three<U::is_any_hook> test (int);
static const std::size_t value = sizeof(test<T>(0));
};
template <class T>
struct internal_any_hook_bool_is_true
{
static const bool value = internal_any_hook_bool<T>::value > sizeof(one)*2;
};
template <class T>
struct external_value_traits_bool
{
template<bool Add>
struct two_or_three {one _[2 + Add];};
template <class U> static one test(...);
template <class U> static two_or_three<U::external_value_traits> test (int);
static const std::size_t value = sizeof(test<T>(0));
};
template <class T>
struct external_bucket_traits_bool
{
template<bool Add>
struct two_or_three {one _[2 + Add];};
template <class U> static one test(...);
template <class U> static two_or_three<U::external_bucket_traits> test (int);
static const std::size_t value = sizeof(test<T>(0));
};
template <class T>
struct external_value_traits_is_true
{
static const bool value = external_value_traits_bool<T>::value > sizeof(one)*2;
};
template<class Node, class Tag, link_mode_type LinkMode, int> template<class Node, class Tag, link_mode_type LinkMode, int>
struct node_holder struct node_holder
@@ -644,7 +609,7 @@ struct store_cont_ptr_on_it
{ {
typedef typename Container::value_traits value_traits; typedef typename Container::value_traits value_traits;
static const bool value = store_cont_ptr_on_it_impl static const bool value = store_cont_ptr_on_it_impl
<value_traits, external_value_traits_is_true<value_traits>::value>::value; <value_traits, external_value_traits_bool_is_true<value_traits>::value>::value;
}; };
template<class Container, bool IsConst> template<class Container, bool IsConst>

File diff suppressed because it is too large Load Diff

View File

@@ -83,7 +83,7 @@ class list_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -57,12 +57,6 @@ struct eval_value_traits
typedef typename ValueTraits::value_traits type; typedef typename ValueTraits::value_traits type;
}; };
template <class T>
struct external_bucket_traits_is_true
{
static const bool value = external_bucket_traits_bool<T>::value == 3;
};
template <class BucketTraits> template <class BucketTraits>
struct eval_bucket_traits struct eval_bucket_traits
{ {

View File

@@ -170,7 +170,7 @@ struct pointer_traits
template<class UPtr> template<class UPtr>
static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr) static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr)
{ return pointer_to(static_cast<element_type&>(*uptr)); } { return pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))); }
//priv_const_cast_from //priv_const_cast_from
template<class UPtr> template<class UPtr>

View File

@@ -89,7 +89,7 @@ class rbtree_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -805,26 +805,26 @@ class rbtree_algorithms
// NodeTraits::get_parent(NodeTraits::get_parent(p)) == p; // 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 || NodeTraits::get_color(x) == NodeTraits::black())){
while(x != NodeTraits::get_parent(header) && (x == node_ptr() || NodeTraits::get_color(x) == NodeTraits::black())){
if(x == NodeTraits::get_left(x_parent)){ if(x == NodeTraits::get_left(x_parent)){
node_ptr w = NodeTraits::get_right(x_parent); node_ptr w = NodeTraits::get_right(x_parent);
BOOST_ASSERT(w);
if(NodeTraits::get_color(w) == NodeTraits::red()){ if(NodeTraits::get_color(w) == NodeTraits::red()){
NodeTraits::set_color(w, NodeTraits::black()); NodeTraits::set_color(w, NodeTraits::black());
NodeTraits::set_color(x_parent, NodeTraits::red()); NodeTraits::set_color(x_parent, NodeTraits::red());
tree_algorithms::rotate_left(x_parent, header); tree_algorithms::rotate_left(x_parent, header);
w = NodeTraits::get_right(x_parent); w = NodeTraits::get_right(x_parent);
} }
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::get_right(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){ (!NodeTraits::get_right(w) || NodeTraits::get_color(NodeTraits::get_right(w)) == NodeTraits::black())){
NodeTraits::set_color(w, NodeTraits::red()); NodeTraits::set_color(w, NodeTraits::red());
x = x_parent; x = x_parent;
x_parent = NodeTraits::get_parent(x_parent); x_parent = NodeTraits::get_parent(x_parent);
} }
else { 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(NodeTraits::get_left(w), NodeTraits::black());
NodeTraits::set_color(w, NodeTraits::red()); NodeTraits::set_color(w, NodeTraits::red());
tree_algorithms::rotate_right(w, header); tree_algorithms::rotate_right(w, header);
@@ -847,14 +847,14 @@ class rbtree_algorithms
tree_algorithms::rotate_right(x_parent, header); tree_algorithms::rotate_right(x_parent, header);
w = NodeTraits::get_left(x_parent); w = NodeTraits::get_left(x_parent);
} }
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::get_left(w) == node_ptr() || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){ (!NodeTraits::get_left(w) || NodeTraits::get_color(NodeTraits::get_left(w)) == NodeTraits::black())){
NodeTraits::set_color(w, NodeTraits::red()); NodeTraits::set_color(w, NodeTraits::red());
x = x_parent; x = x_parent;
x_parent = NodeTraits::get_parent(x_parent); x_parent = NodeTraits::get_parent(x_parent);
} }
else { 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(NodeTraits::get_right(w), NodeTraits::black());
NodeTraits::set_color(w, NodeTraits::red()); NodeTraits::set_color(w, NodeTraits::red());
tree_algorithms::rotate_left(w, header); 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()); NodeTraits::set_color(p, NodeTraits::red());
while(p != NodeTraits::get_parent(header) && NodeTraits::get_color(NodeTraits::get_parent(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)); node_ptr p_parent(NodeTraits::get_parent(p));

View File

@@ -215,7 +215,7 @@ class sgtree_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -112,7 +112,7 @@ class slist_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -88,7 +88,7 @@ class splaytree_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>

View File

@@ -91,7 +91,7 @@ class treap_impl
typedef typename Config::value_traits value_traits; typedef typename Config::value_traits value_traits;
/// @cond /// @cond
static const bool external_value_traits = static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value; detail::external_value_traits_bool_is_true<value_traits>::value;
typedef typename detail::eval_if_c typedef typename detail::eval_if_c
< external_value_traits < external_value_traits
, detail::eval_value_traits<value_traits> , detail::eval_value_traits<value_traits>