42 inline typename PB_DS_CLASS_C_DEC::iterator
44 find_by_order(size_type order)
50 node_iterator nd_it = node_begin();
54 if (order > nd_it.get_metadata())
55 return ++base_type::rightmost_it(nd_it);
57 const size_type num_children = nd_it.num_children();
58 if (num_children == 0)
61 for (size_type i = 0; i < num_children; ++i)
63 node_iterator child_nd_it = nd_it.get_child(i);
64 if (order <= child_nd_it.get_metadata())
70 order -= child_nd_it.get_metadata();
76 inline typename PB_DS_CLASS_C_DEC::const_iterator
78 find_by_order(size_type order)
const
79 {
return const_cast<PB_DS_CLASS_C_DEC*
>(
this)->find_by_order(order); }
82 inline typename PB_DS_CLASS_C_DEC::size_type
84 order_of_key(key_const_reference r_key)
const
86 const _ATraits& r_traits =
87 const_cast<PB_DS_CLASS_C_DEC*
>(
this)->get_access_traits();
89 return order_of_prefix(r_traits.begin(r_key), r_traits.end(r_key));
93 inline typename PB_DS_CLASS_C_DEC::size_type
95 order_of_prefix(
typename access_traits::const_iterator b,
96 typename access_traits::const_iterator e)
const
101 const _ATraits& r_traits =
102 const_cast<PB_DS_CLASS_C_DEC*
>(
this)->get_access_traits();
104 node_const_iterator nd_it = node_begin();
105 node_const_iterator end_nd_it = node_end();
110 const size_type num_children = nd_it.num_children();
111 if (num_children == 0)
113 key_const_reference r_key = base_type::extract_key(*(*nd_it));
114 typename access_traits::const_iterator key_b =
115 r_traits.begin(r_key);
117 typename access_traits::const_iterator key_e =
120 return (base_type::less(key_b, key_e, b, e, r_traits)) ?
124 node_const_iterator next_nd_it = end_nd_it;
125 size_type i = num_children - 1;
129 node_const_iterator child_nd_it = nd_it.get_child(i);
131 if (next_nd_it != end_nd_it)
132 ord += child_nd_it.get_metadata();
133 else if (!base_type::less(b, e,
134 child_nd_it.valid_prefix().first,
135 child_nd_it.valid_prefix().second,
137 next_nd_it = child_nd_it;
141 if (next_nd_it == end_nd_it)
151 operator()(node_iterator nd_it, node_const_iterator )
const
153 const size_type num_children = nd_it.num_children();
154 size_type children_rank = 0;
155 for (size_type i = 0; i < num_children; ++i)
156 children_rank += nd_it.get_child(i).get_metadata();
158 const size_type res = (num_children == 0) ? 1 : children_rank;
159 const_cast<size_type&
>(nd_it.get_metadata()) = res;
auto end(_Container &__cont) -> decltype(__cont.end())
Return an iterator pointing to one past the last element of the container.