46 assert_valid(
const char* __file,
int __line)
const 48 structure_only_assert_valid(__file, __line);
49 assert_consistent_with_debug_base(__file, __line);
50 assert_size(__file, __line);
51 assert_iterators(__file, __line);
52 if (m_p_head->m_p_parent == 0)
54 PB_DS_DEBUG_VERIFY(m_size == 0);
58 PB_DS_DEBUG_VERIFY(m_size > 0);
65 structure_only_assert_valid(
const char* __file,
int __line)
const 67 PB_DS_DEBUG_VERIFY(m_p_head != 0);
68 if (m_p_head->m_p_parent == 0)
70 PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);
71 PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);
75 PB_DS_DEBUG_VERIFY(m_p_head->m_p_parent->m_p_parent == m_p_head);
76 PB_DS_DEBUG_VERIFY(m_p_head->m_p_left != m_p_head);
77 PB_DS_DEBUG_VERIFY(m_p_head->m_p_right != m_p_head);
80 if (m_p_head->m_p_parent != 0)
81 assert_node_consistent(m_p_head->m_p_parent, __file, __line);
82 assert_min(__file, __line);
83 assert_max(__file, __line);
89 assert_node_consistent(
const node_pointer p_nd,
90 const char* __file,
int __line)
const 92 assert_node_consistent_(p_nd, __file, __line);
96 typename PB_DS_CLASS_C_DEC::node_consistent_t
98 assert_node_consistent_(
const node_pointer p_nd,
99 const char* __file,
int __line)
const 104 assert_node_consistent_with_left(p_nd, __file, __line);
105 assert_node_consistent_with_right(p_nd, __file, __line);
108 l_range = assert_node_consistent_(p_nd->m_p_left, __file, __line);
111 PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*l_range.
second),
112 PB_DS_V2F(p_nd->m_value)));
115 r_range = assert_node_consistent_(p_nd->m_p_right, __file, __line);
117 if (r_range.
first != 0)
118 PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
119 PB_DS_V2F(*r_range.
first)));
122 (r_range.
second != 0)? r_range.
second : &p_nd->m_value);
128 assert_node_consistent_with_left(
const node_pointer p_nd,
129 const char* __file,
int __line)
const 131 if (p_nd->m_p_left == 0)
133 PB_DS_DEBUG_VERIFY(p_nd->m_p_left->m_p_parent == p_nd);
134 PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),
135 PB_DS_V2F(p_nd->m_p_left->m_value)));
141 assert_node_consistent_with_right(
const node_pointer p_nd,
142 const char* __file,
int __line)
const 144 if (p_nd->m_p_right == 0)
146 PB_DS_DEBUG_VERIFY(p_nd->m_p_right->m_p_parent == p_nd);
147 PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),
148 PB_DS_V2F(p_nd->m_value)));
154 assert_min(
const char* __file,
int __line)
const 156 assert_min_imp(m_p_head->m_p_parent, __file, __line);
162 assert_min_imp(
const node_pointer p_nd,
const char* __file,
int __line)
const 166 PB_DS_DEBUG_VERIFY(m_p_head->m_p_left == m_p_head);
170 if (p_nd->m_p_left == 0)
172 PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_left);
175 assert_min_imp(p_nd->m_p_left, __file, __line);
181 assert_max(
const char* __file,
int __line)
const 183 assert_max_imp(m_p_head->m_p_parent, __file, __line);
189 assert_max_imp(
const node_pointer p_nd,
190 const char* __file,
int __line)
const 194 PB_DS_DEBUG_VERIFY(m_p_head->m_p_right == m_p_head);
198 if (p_nd->m_p_right == 0)
200 PB_DS_DEBUG_VERIFY(p_nd == m_p_head->m_p_right);
204 assert_max_imp(p_nd->m_p_right, __file, __line);
210 assert_iterators(
const char* __file,
int __line)
const 212 size_type iterated_num = 0;
213 const_iterator prev_it =
end();
214 for (const_iterator it =
begin(); it !=
end(); ++it)
217 PB_DS_DEBUG_VERIFY(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd);
218 const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));
220 PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == it.m_p_nd);
222 if (prev_it !=
end())
223 PB_DS_DEBUG_VERIFY(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),
228 PB_DS_DEBUG_VERIFY(iterated_num == m_size);
229 size_type reverse_iterated_num = 0;
230 const_reverse_iterator reverse_prev_it =
rend();
231 for (const_reverse_iterator reverse_it =
rbegin(); reverse_it !=
rend();
234 ++reverse_iterated_num;
235 PB_DS_DEBUG_VERIFY(lower_bound(
236 PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd);
238 const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it));
240 PB_DS_DEBUG_VERIFY(upper_bound_it.m_p_nd == reverse_it.m_p_nd);
241 if (reverse_prev_it !=
rend())
242 PB_DS_DEBUG_VERIFY(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it),
243 PB_DS_V2F(*reverse_it)));
244 reverse_prev_it = reverse_it;
246 PB_DS_DEBUG_VERIFY(reverse_iterated_num == m_size);
252 assert_consistent_with_debug_base(
const char* __file,
int __line)
const 254 debug_base::check_size(m_size, __file, __line);
255 assert_consistent_with_debug_base(m_p_head->m_p_parent, __file, __line);
261 assert_consistent_with_debug_base(
const node_pointer p_nd,
262 const char* __file,
int __line)
const 266 debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value), __file, __line);
267 assert_consistent_with_debug_base(p_nd->m_p_left, __file, __line);
268 assert_consistent_with_debug_base(p_nd->m_p_right, __file, __line);
274 assert_size(
const char* __file,
int __line)
const 275 { PB_DS_DEBUG_VERIFY(recursive_count(m_p_head->m_p_parent) == m_size); }
_T2 second
first is a copy of the first object
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
_T1 first
second_type is the second bound type
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
_GLIBCXX17_CONSTEXPR auto rend(_Container &__cont) -> decltype(__cont.rend())
Return a reverse iterator pointing one past the first element of the container.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
Struct holding two objects of arbitrary type.
_GLIBCXX17_CONSTEXPR auto rbegin(_Container &__cont) -> decltype(__cont.rbegin())
Return a reverse iterator pointing to the last element of the container.