42 typename PB_DS_CLASS_C_DEC::node_allocator
43 PB_DS_CLASS_C_DEC::s_node_allocator;
47 PB_DS_BIN_TREE_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)
50 PB_DS_STRUCT_ONLY_ASSERT_VALID((*
this))
55 PB_DS_BIN_TREE_NAME(
const Cmp_Fn& r_cmp_fn) :
56 Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)
59 PB_DS_STRUCT_ONLY_ASSERT_VALID((*
this))
64 PB_DS_BIN_TREE_NAME(
const Cmp_Fn& r_cmp_fn,
const node_update& r_node_update) :
66 node_update(r_node_update),
67 m_p_head(s_node_allocator.allocate(1)),
71 PB_DS_STRUCT_ONLY_ASSERT_VALID((*
this))
76 PB_DS_BIN_TREE_NAME(
const PB_DS_CLASS_C_DEC& other) :
80 #ifdef PB_DS_TREE_TRACE
81 PB_DS_TREE_TRACE_BASE_C_DEC(other),
85 m_p_head(s_node_allocator.allocate(1)),
89 m_size = other.m_size;
90 PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
94 m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);
95 if (m_p_head->m_p_parent != 0)
96 m_p_head->m_p_parent->m_p_parent = m_p_head;
97 m_size = other.m_size;
102 _GLIBCXX_DEBUG_ONLY(debug_base::clear();)
103 s_node_allocator.deallocate(m_p_head, 1);
104 __throw_exception_again;
106 PB_DS_STRUCT_ONLY_ASSERT_VALID((*
this))
112 swap(PB_DS_CLASS_C_DEC& other)
114 PB_DS_STRUCT_ONLY_ASSERT_VALID((*
this))
115 PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
117 std::
swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);
118 PB_DS_STRUCT_ONLY_ASSERT_VALID((*this))
119 PB_DS_STRUCT_ONLY_ASSERT_VALID(other)
125 value_swap(PB_DS_CLASS_C_DEC& other)
134 ~PB_DS_BIN_TREE_NAME()
137 s_node_allocator.deallocate(m_p_head, 1);
145 m_p_head->m_p_parent = 0;
146 m_p_head->m_p_left = m_p_head;
147 m_p_head->m_p_right = m_p_head;
152 typename PB_DS_CLASS_C_DEC::node_pointer
154 recursive_copy_node(
const node_pointer p_nd)
159 node_pointer p_ret = s_node_allocator.allocate(1);
162 new (p_ret) node(*p_nd);
166 s_node_allocator.deallocate(p_ret, 1);
167 __throw_exception_again;
170 p_ret->m_p_left = p_ret->m_p_right = 0;
174 p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left);
175 p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right);
180 __throw_exception_again;
183 if (p_ret->m_p_left != 0)
184 p_ret->m_p_left->m_p_parent = p_ret;
186 if (p_ret->m_p_right != 0)
187 p_ret->m_p_right->m_p_parent = p_ret;
189 PB_DS_ASSERT_NODE_CONSISTENT(p_ret)
198 if (m_p_head->m_p_parent == 0)
200 m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;
205 node_pointer p_min = m_p_head->m_p_parent;
206 while (p_min->m_p_left != 0)
207 p_min = p_min->m_p_left;
208 m_p_head->m_p_left = p_min;
212 node_pointer p_max = m_p_head->m_p_parent;
213 while (p_max->m_p_right != 0)
214 p_max = p_max->m_p_right;
215 m_p_head->m_p_right = p_max;
ISO C++ entities toplevel namespace is std.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.