41#ifdef PB_DS_CLASS_C_DEC
44inline typename PB_DS_CLASS_C_DEC::point_iterator
46find(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)
68inline typename PB_DS_CLASS_C_DEC::point_const_iterator
70find(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)
93inline typename PB_DS_CLASS_C_DEC::node_pointer
95find_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);
121inline typename PB_DS_CLASS_C_DEC::node_pointer
123lower_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;
160inline typename PB_DS_CLASS_C_DEC::point_iterator
162lower_bound(key_const_reference r_key)
163{
return point_iterator(lower_bound_imp(r_key)); }
166inline typename PB_DS_CLASS_C_DEC::point_const_iterator
168lower_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));
174inline typename PB_DS_CLASS_C_DEC::point_iterator
176upper_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)))
192inline typename PB_DS_CLASS_C_DEC::point_const_iterator
194upper_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)))
209inline typename PB_DS_CLASS_C_DEC::a_const_iterator
211pref_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();
221inline typename PB_DS_CLASS_C_DEC::a_const_iterator
223pref_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();
233inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
235leftmost_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();
243inline typename PB_DS_CLASS_C_DEC::leaf_pointer
245leftmost_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();
253inline typename PB_DS_CLASS_C_DEC::leaf_const_pointer
255rightmost_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();
263inline typename PB_DS_CLASS_C_DEC::leaf_pointer
265rightmost_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();
_Tp * end(valarray< _Tp > &__va) noexcept
Return an iterator pointing to one past the last element of the valarray.
constexpr auto empty(const _Container &__cont) noexcept(noexcept(__cont.empty())) -> decltype(__cont.empty())
Return whether a container is empty.