42 template<
typename Pred>
51 if (base_type::empty())
58 base_type::to_linked_list();
59 node_pointer p_out = base_type::prune(pred);
66 node_pointer p_next = p_out->m_p_next_sibling;
67 p_out->m_p_l_child = p_out->m_p_prev_or_parent = 0;
68 p_out->m_metadata = 0;
70 p_out->m_p_next_sibling = other.m_p_root;
71 if (other.m_p_root != 0)
72 other.m_p_root->m_p_prev_or_parent = p_out;
74 other.m_p_root = p_out;
75 other.m_p_root = other.fix(other.m_p_root);
80 node_pointer p_cur = base_type::m_p_root;
81 base_type::m_p_root = 0;
85 node_pointer p_next = p_cur->m_p_next_sibling;
86 p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = 0;
87 p_cur->m_metadata = 0;
88 p_cur->m_p_next_sibling = base_type::m_p_root;
90 if (base_type::m_p_root != 0)
91 base_type::m_p_root->m_p_prev_or_parent = p_cur;
93 base_type::m_p_root = p_cur;
94 base_type::m_p_root = fix(base_type::m_p_root);
111 node_pointer p_other = other.m_p_root;
115 node_pointer p_next = p_other->m_p_next_sibling;
116 std::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);
119 while (p_other != 0);
121 base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);
122 base_type::m_size += other.m_size;
136 join(node_pointer p_lhs, node_pointer p_rhs)
const
138 node_pointer p_ret = 0;
139 node_pointer p_cur = 0;
141 while (p_lhs != 0 || p_rhs != 0)
146 p_ret = p_cur = p_lhs;
149 p_cur->m_p_next_sibling = p_lhs;
150 p_lhs->m_p_prev_or_parent = p_cur;
154 else if (p_lhs == 0 || p_rhs->m_metadata < p_lhs->m_metadata)
158 p_ret = p_cur = p_rhs;
159 p_rhs = p_rhs->m_p_prev_or_parent;
163 p_cur->m_p_next_sibling = p_rhs;
164 p_rhs = p_rhs->m_p_prev_or_parent;
165 p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;
166 p_cur = p_cur->m_p_next_sibling;
169 else if (p_lhs->m_metadata < p_rhs->m_metadata)
172 p_ret = p_cur = p_lhs;
175 p_cur->m_p_next_sibling = p_lhs;
176 p_lhs->m_p_prev_or_parent = p_cur;
177 p_cur = p_cur->m_p_next_sibling;
179 p_lhs = p_cur->m_p_next_sibling;
183 node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;
184 p_rhs->m_p_next_sibling = p_lhs;
191 p_cur->m_p_next_sibling = 0;
194 p_ret->m_p_prev_or_parent = 0;
#define _GLIBCXX_DEBUG_ASSERT(_Condition)
Definition: debug.h:61
#define true
Definition: stdbool.h:34
#define PB_DS_CLASS_C_DEC
Definition: bin_search_tree_.hpp:71
#define PB_DS_CLASS_T_DEC
Definition: bin_search_tree_.hpp:67
return(unsigned int) __res
#define PB_DS_ASSERT_VALID_COND(X, _StrictlyBinomial)
Definition: binomial_heap_base_.hpp:189
void swap(exception_ptr &__lhs, exception_ptr &__rhs)
Definition: exception_ptr.h:160