41 #ifdef PB_DS_CLASS_C_DEC
44 inline typename PB_DS_CLASS_C_DEC::point_iterator
46 find(key_const_reference r_key)
48 PB_DS_ASSERT_VALID((*
this))
49 node_pointer p_nd = find_imp(r_key);
51 if (p_nd == 0 || p_nd->m_type != leaf_node)
53 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
57 if (synth_access_traits::equal_keys(PB_DS_V2F(
static_cast<leaf_pointer
>(p_nd)->value()), r_key))
59 PB_DS_CHECK_KEY_EXISTS(r_key)
60 return iterator(p_nd);
63 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
68 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
70 find(key_const_reference r_key)
const
72 PB_DS_ASSERT_VALID((*
this))
74 node_const_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);
76 if (p_nd == 0 || p_nd->m_type != leaf_node)
78 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
82 if (synth_access_traits::equal_keys(PB_DS_V2F(
static_cast<leaf_const_pointer
>(p_nd)->value()), r_key))
84 PB_DS_CHECK_KEY_EXISTS(r_key)
85 return const_iterator(
const_cast<node_pointer
>(p_nd));
88 PB_DS_CHECK_KEY_DOES_NOT_EXIST(r_key)
93 inline typename PB_DS_CLASS_C_DEC::node_pointer
95 find_imp(key_const_reference r_key)
100 typename synth_access_traits::const_iterator b_it =
101 synth_access_traits::begin(r_key);
102 typename synth_access_traits::const_iterator e_it =
103 synth_access_traits::end(r_key);
105 node_pointer p_nd = m_p_head->m_p_parent;
106 _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
108 while (p_nd->m_type != leaf_node)
110 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
111 node_pointer p_next_nd =
static_cast<inode_pointer
>(p_nd)->get_child_node(b_it, e_it,
this);
121 inline typename PB_DS_CLASS_C_DEC::node_pointer
123 lower_bound_imp(key_const_reference r_key)
128 node_pointer p_nd = m_p_head->m_p_parent;
129 _GLIBCXX_DEBUG_ASSERT(p_nd != 0);
131 typename PB_DS_CLASS_C_DEC::a_const_iterator b_it =
132 synth_access_traits::begin(r_key);
134 typename PB_DS_CLASS_C_DEC::a_const_iterator e_it =
135 synth_access_traits::end(r_key);
137 size_type checked_ind = 0;
140 if (p_nd->m_type == leaf_node)
142 if (!synth_access_traits::cmp_keys(PB_DS_V2F(
static_cast<leaf_const_pointer
>(p_nd)->value()), r_key))
149 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
150 const size_type new_checked_ind =
151 static_cast<inode_pointer
>(p_nd)->get_e_ind();
154 static_cast<inode_pointer
>(p_nd)->get_lower_bound_child_node( b_it, e_it, checked_ind,
this);
155 checked_ind = new_checked_ind;
160 inline typename PB_DS_CLASS_C_DEC::point_iterator
162 lower_bound(key_const_reference r_key)
163 {
return point_iterator(lower_bound_imp(r_key)); }
166 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
168 lower_bound(key_const_reference r_key)
const
170 return point_const_iterator(
const_cast<PB_DS_CLASS_C_DEC*
>(
this)->lower_bound_imp(r_key));
174 inline typename PB_DS_CLASS_C_DEC::point_iterator
176 upper_bound(key_const_reference r_key)
178 point_iterator l_bound_it = lower_bound(r_key);
180 _GLIBCXX_DEBUG_ASSERT(l_bound_it ==
end() ||
181 !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
184 if (l_bound_it ==
end() ||
185 synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
192 inline typename PB_DS_CLASS_C_DEC::point_const_iterator
194 upper_bound(key_const_reference r_key)
const
196 point_const_iterator l_bound_it = lower_bound(r_key);
198 _GLIBCXX_DEBUG_ASSERT(l_bound_it ==
end() ||
199 !synth_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),
202 if (l_bound_it ==
end() ||
203 synth_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))
209 inline typename PB_DS_CLASS_C_DEC::a_const_iterator
211 pref_begin(node_const_pointer p_nd)
213 if (p_nd->m_type == leaf_node)
214 return (synth_access_traits::begin(PB_DS_V2F(
static_cast<leaf_const_pointer
>(p_nd)->value())));
216 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
217 return static_cast<inode_const_pointer
>(p_nd)->pref_b_it();
221 inline typename PB_DS_CLASS_C_DEC::a_const_iterator
223 pref_end(node_const_pointer p_nd)
225 if (p_nd->m_type == leaf_node)
226 return (synth_access_traits::end(PB_DS_V2F(
static_cast<leaf_const_pointer
>(p_nd)->value())));
228 _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == i_node);
229 return static_cast<inode_const_pointer
>(p_nd)->pref_e_it();
233 inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
235 leftmost_descendant(node_const_pointer p_nd)
237 if (p_nd->m_type == leaf_node)
238 return static_cast<leaf_const_pointer
>(p_nd);
239 return static_cast<inode_const_pointer
>(p_nd)->leftmost_descendant();
243 inline typename PB_DS_CLASS_C_DEC::leaf_pointer
245 leftmost_descendant(node_pointer p_nd)
247 if (p_nd->m_type == leaf_node)
248 return static_cast<leaf_pointer
>(p_nd);
249 return static_cast<inode_pointer
>(p_nd)->leftmost_descendant();
253 inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
255 rightmost_descendant(node_const_pointer p_nd)
257 if (p_nd->m_type == leaf_node)
258 return static_cast<leaf_const_pointer
>(p_nd);
259 return static_cast<inode_const_pointer
>(p_nd)->rightmost_descendant();
263 inline typename PB_DS_CLASS_C_DEC::leaf_pointer
265 rightmost_descendant(node_pointer p_nd)
267 if (p_nd->m_type == leaf_node)
268 return static_cast<leaf_pointer
>(p_nd);
269 return static_cast<inode_pointer
>(p_nd)->rightmost_descendant();
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list.