42 inline typename PB_DS_CLASS_C_DEC::point_iterator
44 find(key_const_reference r_key)
46 PB_DS_ASSERT_VALID((*
this))
47 node_pointer p_nd = find_imp(r_key);
49 if (p_nd == 0 || p_nd->m_type != leaf_node)
51 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
55 if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))
57 PB_DS_CHECK_KEY_EXISTS(r_key)
58 return iterator(p_nd);
61 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
66 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
68 find(key_const_reference r_key)
const
70 PB_DS_ASSERT_VALID((*
this))
72 node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
74 if (p_nd == 0 || p_nd->m_type != leaf_node)
76 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
80 if (synth_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
82 PB_DS_CHECK_KEY_EXISTS(r_key)
83 return const_iterator(const_cast<node_pointer>(p_nd));
86 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
91 inline typename PB_DS_CLASS_C_DEC::node_pointer
93 find_imp(key_const_reference r_key)
98 typename synth_access_traits::const_iterator b_it =
100 typename synth_access_traits::const_iterator e_it =
103 node_pointer p_nd = m_p_head->m_p_parent;
104 _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
106 while (p_nd->m_type != leaf_node)
108 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
109 node_pointer p_next_nd =
static_cast<inode_pointer
>(p_nd)->get_child_node(b_it, e_it,
this);
119 inline typename PB_DS_CLASS_C_DEC::node_pointer
121 lower_bound_imp(key_const_reference r_key)
126 node_pointer p_nd = m_p_head->m_p_parent;
127 _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
129 typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =
132 typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =
135 size_type checked_ind = 0;
138 if (p_nd->m_type == leaf_node)
140 if (!synth_access_traits::cmp_keys(PB_DS_V2F(static_cast<leaf_const_pointer>(p_nd)->value()), r_key))
147 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
148 const size_type new_checked_ind =
149 static_cast<inode_pointer
>(p_nd)->get_e_ind();
152 static_cast<inode_pointer
>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind,
this);
153 checked_ind = new_checked_ind;
158 inline typename PB_DS_CLASS_C_DEC::point_iterator
160 lower_bound(key_const_reference r_key)
161 {
return point_iterator(lower_bound_imp(r_key)); }
164 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
166 lower_bound(key_const_reference r_key)
const
168 return point_const_iterator(const_cast<PB_DS_CLASS_C_DEC* >(
this)->lower_bound_imp(r_key));
172 inline typename PB_DS_CLASS_C_DEC::point_iterator
174 upper_bound(key_const_reference r_key)
176 point_iterator l_bound_it = lower_bound(r_key);
178 _GLIBCXX_DEBUG_ASSERT(l_bound_it ==
end() ||
179 !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
182 if (l_bound_it ==
end() ||
183 synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
190 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
192 upper_bound(key_const_reference r_key)
const
194 point_const_iterator l_bound_it = lower_bound(r_key);
196 _GLIBCXX_DEBUG_ASSERT(l_bound_it ==
end() ||
197 !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
200 if (l_bound_it ==
end() ||
201 synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
207 inline typename PB_DS_CLASS_C_DEC::a_const_iterator
209 pref_begin(node_const_pointer p_nd)
211 if (p_nd->m_type == leaf_node)
214 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
215 return static_cast<inode_const_pointer
>(p_nd)->pref_b_it();
219 inline typename PB_DS_CLASS_C_DEC::a_const_iterator
221 pref_end(node_const_pointer p_nd)
223 if (p_nd->m_type == leaf_node)
226 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
227 return static_cast<inode_const_pointer
>(p_nd)->pref_e_it();
231 inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
233 leftmost_descendant(node_const_pointer p_nd)
235 if (p_nd->m_type == leaf_node)
236 return static_cast<leaf_const_pointer
>(p_nd);
237 return static_cast<inode_const_pointer
>(p_nd)->leftmost_descendant();
241 inline typename PB_DS_CLASS_C_DEC::leaf_pointer
243 leftmost_descendant(node_pointer p_nd)
245 if (p_nd->m_type == leaf_node)
246 return static_cast<leaf_pointer
>(p_nd);
247 return static_cast<inode_pointer
>(p_nd)->leftmost_descendant();
251 inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
253 rightmost_descendant(node_const_pointer p_nd)
255 if (p_nd->m_type == leaf_node)
256 return static_cast<leaf_const_pointer
>(p_nd);
257 return static_cast<inode_const_pointer
>(p_nd)->rightmost_descendant();
261 inline typename PB_DS_CLASS_C_DEC::leaf_pointer
263 rightmost_descendant(node_pointer p_nd)
265 if (p_nd->m_type == leaf_node)
266 return static_cast<leaf_pointer
>(p_nd);
267 return static_cast<inode_pointer
>(p_nd)->rightmost_descendant();
auto end(_Container &__cont) -> decltype(__cont.end())
Return an iterator pointing to one past the last element of the container.
auto begin(_Container &__cont) -> decltype(__cont.begin())
Return an iterator pointing to the first element of the container.