44 join(PB_DS_CLASS_C_DEC& other)
46 PB_DS_ASSERT_VALID((*
this))
47 PB_DS_ASSERT_VALID(other)
48 if (base_type::join_prep(other) == false)
50 PB_DS_ASSERT_VALID((*
this))
51 PB_DS_ASSERT_VALID(other)
55 node_pointer p_target_r = other.leftmost(other.m_p_head);
56 _GLIBCXX_DEBUG_ASSERT(p_target_r != 0);
57 other.splay(p_target_r);
59 _GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);
60 _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == 0);
62 p_target_r->m_p_left = base_type::m_p_head->m_p_parent;
64 _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != 0);
65 p_target_r->m_p_left->m_p_parent = p_target_r;
67 base_type::m_p_head->m_p_parent = p_target_r;
68 p_target_r->m_p_parent = base_type::m_p_head;
70 this->apply_update(p_target_r, (node_update*)this);
71 base_type::join_finish(other);
73 PB_DS_ASSERT_VALID((*this))
74 PB_DS_ASSERT_VALID(other)
80 split(key_const_reference r_key, PB_DS_CLASS_C_DEC& other)
82 PB_DS_ASSERT_VALID((*
this))
83 PB_DS_ASSERT_VALID(other)
85 if (base_type::split_prep(r_key, other) == false)
87 PB_DS_ASSERT_VALID((*
this))
88 PB_DS_ASSERT_VALID(other)
92 node_pointer p_upper_bound = this->upper_bound(r_key).m_p_nd;
93 _GLIBCXX_DEBUG_ASSERT(p_upper_bound != 0);
96 _GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);
98 node_pointer p_new_root = p_upper_bound->m_p_left;
99 _GLIBCXX_DEBUG_ASSERT(p_new_root != 0);
101 base_type::m_p_head->m_p_parent = p_new_root;
102 p_new_root->m_p_parent = base_type::m_p_head;
103 other.m_p_head->m_p_parent = p_upper_bound;
104 p_upper_bound->m_p_parent = other.m_p_head;
105 p_upper_bound->m_p_left = 0;
106 this->apply_update(p_upper_bound, (node_update*)this);
107 base_type::split_finish(other);
109 PB_DS_ASSERT_VALID((*this))
110 PB_DS_ASSERT_VALID(other)