41 #ifdef PB_DS_CLASS_C_DEC
49 _GLIBCXX_DEBUG_ASSERT(m_size == 0);
56 actual_erase_node(node_pointer p_nd)
58 _GLIBCXX_DEBUG_ASSERT(m_size > 0);
61 s_node_allocator.deallocate(p_nd, 1);
67 clear_imp(node_pointer p_nd)
71 clear_imp(p_nd->m_p_l_child);
72 node_pointer p_next = p_nd->m_p_next_sibling;
73 actual_erase_node(p_nd);
83 PB_DS_ASSERT_VALID((*
this))
84 node_pointer p_cur = m_p_root;
86 if (p_cur->m_p_l_child != 0)
88 node_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;
89 p_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;
90 p_cur->m_p_next_sibling = p_cur->m_p_l_child;
91 p_cur->m_p_l_child = p_child_next;
94 p_cur = p_cur->m_p_next_sibling;
97 node_const_pointer p_counter = m_p_root;
99 while (p_counter != 0)
102 _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == 0);
103 p_counter = p_counter->m_p_next_sibling;
105 _GLIBCXX_DEBUG_ASSERT(count == m_size);
110 template<
typename Pred>
111 typename PB_DS_CLASS_C_DEC::node_pointer
115 node_pointer p_cur = m_p_root;
117 node_pointer p_out = 0;
120 node_pointer p_next = p_cur->m_p_next_sibling;
121 if (pred(p_cur->m_value))
123 p_cur->m_p_next_sibling = p_out;
125 p_out->m_p_prev_or_parent = p_cur;
130 p_cur->m_p_next_sibling = m_p_root;
132 m_p_root->m_p_prev_or_parent = p_cur;
143 bubble_to_top(node_pointer p_nd)
145 node_pointer p_parent = parent(p_nd);
146 while (p_parent != 0)
148 swap_with_parent(p_nd, p_parent);
149 p_parent = parent(p_nd);