59 #ifdef PB_DS_DATA_TRUE_INDICATOR
60 #define PB_DS_BIN_TREE_NAME bin_search_tree_map
63 #ifdef PB_DS_DATA_FALSE_INDICATOR
64 #define PB_DS_BIN_TREE_NAME bin_search_tree_set
67 #define PB_DS_CLASS_T_DEC \
68 template<typename Key, typename Mapped, typename Cmp_Fn, \
69 typename Node_And_It_Traits, typename _Alloc>
71 #define PB_DS_CLASS_C_DEC \
72 PB_DS_BIN_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
74 #define PB_DS_BIN_TREE_TRAITS_BASE \
75 types_traits<Key, Mapped, _Alloc, false>
78 #define PB_DS_DEBUG_MAP_BASE_C_DEC \
79 debug_map_base<Key, eq_by_less<Key, Cmp_Fn>, \
80 typename rebind_traits<_Alloc, Key>::const_reference>
83 #ifdef PB_DS_TREE_TRACE
84 #define PB_DS_TREE_TRACE_BASE_C_DEC \
85 tree_trace_base<typename Node_And_It_Traits::node_const_iterator, \
86 typename Node_And_It_Traits::node_iterator, \
97 template<
typename Key,
typename Mapped,
typename Cmp_Fn,
98 typename Node_And_It_Traits,
typename _Alloc>
99 class PB_DS_BIN_TREE_NAME :
100 #ifdef _GLIBCXX_DEBUG
101 public PB_DS_DEBUG_MAP_BASE_C_DEC,
103 #ifdef PB_DS_TREE_TRACE
104 public PB_DS_TREE_TRACE_BASE_C_DEC,
107 public PB_DS_BIN_TREE_TRAITS_BASE,
108 public Node_And_It_Traits::node_update
110 typedef Node_And_It_Traits traits_type;
111 typedef rebind_traits<_Alloc, typename traits_type::node>
115 typedef PB_DS_BIN_TREE_TRAITS_BASE traits_base;
118 typename node_alloc_traits::allocator_type node_allocator;
120 typedef typename node_alloc_traits::value_type node;
121 typedef typename node_alloc_traits::pointer node_pointer;
123 typedef typename traits_type::null_node_update_pointer
124 null_node_update_pointer;
127 typedef cond_dealtor<node, _Alloc> cond_dealtor_t;
129 #ifdef _GLIBCXX_DEBUG
130 typedef PB_DS_DEBUG_MAP_BASE_C_DEC debug_base;
134 typedef typename _Alloc::size_type size_type;
135 typedef typename _Alloc::difference_type difference_type;
136 typedef typename traits_base::key_type key_type;
137 typedef typename traits_base::key_pointer key_pointer;
138 typedef typename traits_base::key_const_pointer key_const_pointer;
139 typedef typename traits_base::key_reference key_reference;
140 typedef typename traits_base::key_const_reference key_const_reference;
142 #ifdef PB_DS_DATA_TRUE_INDICATOR
143 typedef typename traits_base::mapped_type mapped_type;
144 typedef typename traits_base::mapped_pointer mapped_pointer;
145 typedef typename traits_base::mapped_const_pointer mapped_const_pointer;
146 typedef typename traits_base::mapped_reference mapped_reference;
147 typedef typename traits_base::mapped_const_reference mapped_const_reference;
150 typedef typename traits_base::value_type value_type;
151 typedef typename traits_base::pointer pointer;
152 typedef typename traits_base::const_pointer const_pointer;
153 typedef typename traits_base::reference reference;
154 typedef typename traits_base::const_reference const_reference;
155 typedef typename traits_type::point_const_iterator point_const_iterator;
157 typedef point_const_iterator const_iterator;
158 typedef typename traits_type::point_iterator point_iterator;
159 typedef point_iterator iterator;
161 typedef typename traits_type::const_reverse_iterator const_reverse_iterator;
163 typedef typename traits_type::reverse_iterator reverse_iterator;
164 typedef typename traits_type::node_const_iterator node_const_iterator;
165 typedef typename traits_type::node_iterator node_iterator;
166 typedef typename traits_type::node_update node_update;
168 typedef Cmp_Fn cmp_fn;
169 typedef _Alloc allocator_type;
171 PB_DS_BIN_TREE_NAME();
173 PB_DS_BIN_TREE_NAME(
const Cmp_Fn&);
175 PB_DS_BIN_TREE_NAME(
const Cmp_Fn&,
const node_update&);
177 PB_DS_BIN_TREE_NAME(
const PB_DS_CLASS_C_DEC&);
180 swap(PB_DS_CLASS_C_DEC&);
182 ~PB_DS_BIN_TREE_NAME();
199 inline point_iterator
200 lower_bound(key_const_reference);
202 inline point_const_iterator
203 lower_bound(key_const_reference)
const;
205 inline point_iterator
206 upper_bound(key_const_reference);
208 inline point_const_iterator
209 upper_bound(key_const_reference)
const;
211 inline point_iterator
212 find(key_const_reference);
214 inline point_const_iterator
215 find(key_const_reference)
const;
220 inline const_iterator
226 inline const_iterator
229 inline reverse_iterator
232 inline const_reverse_iterator
235 inline reverse_iterator
238 inline const_reverse_iterator
243 inline node_const_iterator
253 inline node_const_iterator
266 value_swap(PB_DS_CLASS_C_DEC&);
269 initialize_min_max();
272 insert_imp_empty(const_reference);
275 insert_leaf_new(const_reference, node_pointer,
bool);
278 get_new_node_for_leaf_insert(const_reference,
false_type);
281 get_new_node_for_leaf_insert(const_reference,
true_type);
284 actual_erase_node(node_pointer);
290 update_min_max_for_erased_node(node_pointer);
293 clear_imp(node_pointer);
296 insert_leaf(const_reference);
299 rotate_left(node_pointer);
302 rotate_right(node_pointer);
305 rotate_parent(node_pointer);
308 apply_update(node_pointer, null_node_update_pointer);
310 template<
typename Node_Update_>
312 apply_update(node_pointer, Node_Update_*);
315 update_to_top(node_pointer, null_node_update_pointer);
317 template<
typename Node_Update_>
319 update_to_top(node_pointer, Node_Update_*);
322 join_prep(PB_DS_CLASS_C_DEC&);
325 join_finish(PB_DS_CLASS_C_DEC&);
328 split_prep(key_const_reference, PB_DS_CLASS_C_DEC&);
331 split_finish(PB_DS_CLASS_C_DEC&);
334 recursive_count(node_pointer)
const;
336 #ifdef _GLIBCXX_DEBUG
338 assert_valid(
const char*,
int)
const;
341 structure_only_assert_valid(
const char*,
int)
const;
344 assert_node_consistent(
const node_pointer,
const char*,
int)
const;
348 #ifdef _GLIBCXX_DEBUG
350 assert_iterators(
const char*,
int)
const;
353 assert_consistent_with_debug_base(
const char*,
int)
const;
356 assert_node_consistent_with_left(
const node_pointer,
357 const char*,
int)
const;
360 assert_node_consistent_with_right(
const node_pointer,
361 const char*,
int)
const;
364 assert_consistent_with_debug_base(
const node_pointer,
365 const char*,
int)
const;
368 assert_min(
const char*,
int)
const;
371 assert_min_imp(
const node_pointer,
const char*,
int)
const;
374 assert_max(
const char*,
int)
const;
377 assert_max_imp(
const node_pointer,
const char*,
int)
const;
380 assert_size(
const char*,
int)
const;
385 assert_node_consistent_(
const node_pointer,
const char*,
int)
const;
392 recursive_copy_node(
const node_pointer);
395 node_pointer m_p_head;
397 static node_allocator s_node_allocator;
400 #define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \
401 _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);)
403 #define PB_DS_ASSERT_NODE_CONSISTENT(_Node) \
404 _GLIBCXX_DEBUG_ONLY(assert_node_consistent(_Node, __FILE__, __LINE__);)
417 #undef PB_DS_ASSERT_NODE_CONSISTENT
418 #undef PB_DS_STRUCT_ONLY_ASSERT_VALID
419 #undef PB_DS_CLASS_C_DEC
420 #undef PB_DS_CLASS_T_DEC
421 #undef PB_DS_BIN_TREE_NAME
422 #undef PB_DS_BIN_TREE_TRAITS_BASE
423 #undef PB_DS_DEBUG_MAP_BASE_C_DEC
425 #ifdef PB_DS_TREE_TRACE
426 #undef PB_DS_TREE_TRACE_BASE_C_DEC
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
GNU extensions for policy-based data structures for public use.
Struct holding two objects of arbitrary type.