42 typename PB_DS_CLASS_C_DEC::value_allocator
43 PB_DS_CLASS_C_DEC::s_value_alloc;
46 typename PB_DS_CLASS_C_DEC::metadata_allocator
47 PB_DS_CLASS_C_DEC::s_metadata_alloc;
51 PB_DS_OV_TREE_NAME() :
56 { PB_DS_ASSERT_VALID((*
this)) }
60 PB_DS_OV_TREE_NAME(
const Cmp_Fn& r_cmp_fn) :
66 { PB_DS_ASSERT_VALID((*
this)) }
70 PB_DS_OV_TREE_NAME(
const Cmp_Fn& r_cmp_fn,
const node_update& r_nodeu) :
77 { PB_DS_ASSERT_VALID((*
this)) }
81 PB_DS_OV_TREE_NAME(
const PB_DS_CLASS_C_DEC& other) :
82 #ifdef PB_DS_TREE_TRACE
92 copy_from_ordered_range(other.begin(), other.end());
93 PB_DS_ASSERT_VALID((*
this))
100 copy_from_range(It first_it, It last_it)
102 #ifdef PB_DS_DATA_TRUE_INDICATOR 103 typedef std::map<key_type, mapped_type, Cmp_Fn,
104 typename _Alloc::template rebind<value_type>::other>
108 typename _Alloc::template rebind<Key>::other>
112 map_type m(first_it, last_it);
113 copy_from_ordered_range(m.begin(), m.end());
114 PB_DS_ASSERT_VALID((*
this))
118 template<
typename It>
121 copy_from_ordered_range(It first_it, It last_it)
127 value_vector a_values = s_value_alloc.allocate(len);
128 iterator target_it = a_values;
129 It source_it = first_it;
130 It source_end_it = last_it;
132 cond_dtor<size_type> cd(a_values, target_it, len);
133 while (source_it != source_end_it)
135 void* __v = const_cast<void*>(static_cast<const void*>(target_it));
136 new (__v) value_type(*source_it++);
140 reallocate_metadata((node_update*)
this, len);
142 m_a_values = a_values;
144 m_end_it = m_a_values + m_size;
145 update(PB_DS_node_begin_imp(), (node_update*)
this);
147 #ifdef _GLIBCXX_DEBUG 148 for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
149 debug_base::insert_new(PB_DS_V2F(*dbg_it));
154 template<
typename It>
157 copy_from_ordered_range(It first_it, It last_it, It other_first_it,
164 value_vector a_values = s_value_alloc.allocate(len);
166 iterator target_it = a_values;
167 It source_it = first_it;
168 It source_end_it = last_it;
170 cond_dtor<size_type> cd(a_values, target_it, len);
171 while (source_it != source_end_it)
173 new (const_cast<void* >(static_cast<const void* >(target_it)))
174 value_type(*source_it++);
178 source_it = other_first_it;
179 source_end_it = other_last_it;
181 while (source_it != source_end_it)
183 new (const_cast<void* >(static_cast<const void* >(target_it)))
184 value_type(*source_it++);
188 reallocate_metadata((node_update* )
this, len);
190 m_a_values = a_values;
192 m_end_it = m_a_values + m_size;
193 update(PB_DS_node_begin_imp(), (node_update* )
this);
195 #ifdef _GLIBCXX_DEBUG 196 for (const_iterator dbg_it = m_a_values; dbg_it != m_end_it; ++dbg_it)
197 debug_base::insert_new(PB_DS_V2F(*dbg_it));
204 swap(PB_DS_CLASS_C_DEC& other)
206 PB_DS_ASSERT_VALID((*
this))
207 PB_DS_ASSERT_VALID(other)
209 std::swap(static_cast<cmp_fn&>(*this),
210 static_cast<cmp_fn&>(other));
211 std::swap(static_cast<traits_base&>(*this),
212 static_cast<traits_base&>(other));
213 PB_DS_ASSERT_VALID(other)
214 PB_DS_ASSERT_VALID((*this))
220 value_swap(PB_DS_CLASS_C_DEC& other)
222 _GLIBCXX_DEBUG_ONLY(debug_base::swap(other);)
223 std::swap(m_a_values, other.m_a_values);
224 std::swap(m_a_metadata, other.m_a_metadata);
225 std::swap(m_size, other.m_size);
226 std::swap(m_end_it, other.m_end_it);
231 ~PB_DS_OV_TREE_NAME()
233 PB_DS_ASSERT_VALID((*
this))
234 cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);
235 reallocate_metadata((node_update*)this, 0);
241 update(node_iterator, null_node_update_pointer)
245 template<
typename Node_Update>
248 update(node_iterator nd_it, Node_Update* p_update)
250 node_const_iterator end_it = PB_DS_node_end_imp();
253 update(nd_it.get_l_child(), p_update);
254 update(nd_it.get_r_child(), p_update);
255 node_update::operator()(nd_it, end_it);
_GLIBCXX17_CONSTEXPR iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
ISO C++ entities toplevel namespace is std.
A standard container made up of unique keys, which can be retrieved in logarithmic time.
A standard container made up of (key,value) pairs, which can be retrieved based on a key,...