46 PB_DS_ASSERT_VALID((*
this))
47 _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
48 _GLIBCXX_DEBUG_ASSERT(m_p_max != 0);
50 node_pointer p_nd = m_p_max;
52 base_type::actual_erase_node(p_nd);
53 PB_DS_ASSERT_VALID((*this))
70 node_pointer p_add = base_type::m_p_root;
71 while (p_add != m_p_max)
73 node_pointer p_next_add = p_add->m_p_next_sibling;
78 p_add = m_p_max->m_p_l_child;
81 node_pointer p_next_add = p_add->m_p_next_sibling;
82 p_add->m_metadata = p_add->m_p_l_child == 0 ?
83 0 : p_add->m_p_l_child->m_metadata + 1;
89 p_add = m_p_max->m_p_next_sibling;
92 node_pointer p_next_add = p_add->m_p_next_sibling;
101 add_to_aux(node_pointer p_nd)
103 size_type r = p_nd->m_metadata;
104 while (m_a_aux[r] != 0)
106 _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
107 if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))
108 make_child_of(m_a_aux[r], p_nd);
111 make_child_of(p_nd, m_a_aux[r]);
119 _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());
127 make_child_of(node_pointer p_nd, node_pointer p_new_parent)
129 _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata);
130 _GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd ||
131 m_a_aux[p_nd->m_metadata] == p_new_parent);
133 ++p_new_parent->m_metadata;
134 base_type::make_child_of(p_nd, p_new_parent);
142 base_type::m_p_root = m_p_max = 0;
143 const size_type rnk_bnd = rank_bound();
149 make_root_and_link(m_a_aux[i]);
155 PB_DS_ASSERT_AUX_NULL((*
this))
161 remove_node(node_pointer p_nd)
163 node_pointer p_parent = p_nd;
164 while (base_type::parent(p_parent) != 0)
165 p_parent = base_type::parent(p_parent);
167 base_type::bubble_to_top(p_nd);
170 node_pointer p_fix = base_type::m_p_root;
171 while (p_fix != 0&& p_fix->m_p_next_sibling != p_parent)
172 p_fix = p_fix->m_p_next_sibling;
175 p_fix->m_p_next_sibling = p_nd;
192 erase(point_iterator it)
194 PB_DS_ASSERT_VALID((*
this))
195 _GLIBCXX_DEBUG_ASSERT(!base_type::empty());
197 node_pointer p_nd = it.m_p_nd;
199 base_type::actual_erase_node(p_nd);
200 PB_DS_ASSERT_VALID((*this))
204 template<typename Pred>
205 typename PB_DS_CLASS_C_DEC::size_type
209 PB_DS_ASSERT_VALID((*
this))
210 if (base_type::empty())
212 PB_DS_ASSERT_VALID((*
this))
216 base_type::to_linked_list();
217 node_pointer p_out = base_type::prune(pred);
222 node_pointer p_next = p_out->m_p_next_sibling;
223 base_type::actual_erase_node(p_out);
227 node_pointer p_cur = base_type::m_p_root;
228 m_p_max = base_type::m_p_root = 0;
231 node_pointer p_next = p_cur->m_p_next_sibling;
232 make_root_and_link(p_cur);
236 PB_DS_ASSERT_VALID((*
this))
241 inline typename PB_DS_CLASS_C_DEC::size_type
246 const size_t*
const p_upper =
248 g_a_rank_bounds + num_distinct_rank_bounds,
251 if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)
254 return (p_upper - g_a_rank_bounds);
_ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__val, _Compare __comp)
Finds the last position in which __val could be inserted without changing the ordering.