51 #define PB_DS_CLASS_T_DEC \ 52 template<typename Key, typename Mapped, typename Cmp_Fn, \ 53 typename Node_And_It_Traits, typename _Alloc> 55 #ifdef PB_DS_DATA_TRUE_INDICATOR 56 # define PB_DS_RB_TREE_NAME rb_tree_map 57 # define PB_DS_RB_TREE_BASE_NAME bin_search_tree_map 60 #ifdef PB_DS_DATA_FALSE_INDICATOR 61 # define PB_DS_RB_TREE_NAME rb_tree_set 62 # define PB_DS_RB_TREE_BASE_NAME bin_search_tree_set 65 #define PB_DS_CLASS_C_DEC \ 66 PB_DS_RB_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> 68 #define PB_DS_RB_TREE_BASE \ 69 PB_DS_RB_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc> 79 template<
typename Key,
82 typename Node_And_It_Traits,
84 class PB_DS_RB_TREE_NAME :
public PB_DS_RB_TREE_BASE
87 typedef PB_DS_RB_TREE_BASE base_type;
88 typedef typename base_type::node_pointer node_pointer;
92 typedef Cmp_Fn cmp_fn;
93 typedef _Alloc allocator_type;
94 typedef typename _Alloc::size_type size_type;
95 typedef typename _Alloc::difference_type difference_type;
96 typedef typename base_type::key_type key_type;
97 typedef typename base_type::key_pointer key_pointer;
98 typedef typename base_type::key_const_pointer key_const_pointer;
99 typedef typename base_type::key_reference key_reference;
100 typedef typename base_type::key_const_reference key_const_reference;
101 typedef typename base_type::mapped_type mapped_type;
102 typedef typename base_type::mapped_pointer mapped_pointer;
103 typedef typename base_type::mapped_const_pointer mapped_const_pointer;
104 typedef typename base_type::mapped_reference mapped_reference;
105 typedef typename base_type::mapped_const_reference mapped_const_reference;
106 typedef typename base_type::value_type value_type;
107 typedef typename base_type::pointer pointer;
108 typedef typename base_type::const_pointer const_pointer;
109 typedef typename base_type::reference reference;
110 typedef typename base_type::const_reference const_reference;
111 typedef typename base_type::point_iterator point_iterator;
112 typedef typename base_type::const_iterator point_const_iterator;
113 typedef typename base_type::iterator iterator;
114 typedef typename base_type::const_iterator const_iterator;
115 typedef typename base_type::reverse_iterator reverse_iterator;
116 typedef typename base_type::const_reverse_iterator const_reverse_iterator;
117 typedef typename base_type::node_update node_update;
119 PB_DS_RB_TREE_NAME();
121 PB_DS_RB_TREE_NAME(
const Cmp_Fn&);
123 PB_DS_RB_TREE_NAME(
const Cmp_Fn&,
const node_update&);
125 PB_DS_RB_TREE_NAME(
const PB_DS_CLASS_C_DEC&);
128 swap(PB_DS_CLASS_C_DEC&);
130 template<
typename It>
132 copy_from_range(It, It);
135 insert(const_reference);
137 inline mapped_reference
138 operator[](key_const_reference r_key)
140 #ifdef PB_DS_DATA_TRUE_INDICATOR 141 _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
143 base_type::insert_leaf(value_type(r_key, mapped_type()));
145 if (ins_pair.second ==
true)
147 ins_pair.first.m_p_nd->m_red =
true;
148 _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid(__FILE__, __LINE__);)
149 insert_fixup(ins_pair.first.m_p_nd);
151 _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
152 return ins_pair.first.m_p_nd->m_value.second;
155 return base_type::s_null_type;
160 erase(key_const_reference);
165 inline reverse_iterator
166 erase(reverse_iterator);
168 template<
typename Pred>
173 join(PB_DS_CLASS_C_DEC&);
176 split(key_const_reference, PB_DS_CLASS_C_DEC&);
180 #ifdef _GLIBCXX_DEBUG 182 assert_valid(
const char*,
int)
const;
185 assert_node_consistent(
const node_pointer,
const char*,
int)
const;
189 is_effectively_black(
const node_pointer);
195 insert_fixup(node_pointer);
198 erase_node(node_pointer);
201 remove_node(node_pointer);
204 remove_fixup(node_pointer, node_pointer);
207 split_imp(node_pointer, PB_DS_CLASS_C_DEC&);
216 join_imp(node_pointer, node_pointer);
219 find_join_pos_right(node_pointer, size_type, size_type);
222 find_join_pos_left(node_pointer, size_type, size_type);
225 black_height(node_pointer);
228 split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);
231 #define PB_DS_STRUCT_ONLY_ASSERT_VALID(X) \ 232 _GLIBCXX_DEBUG_ONLY(X.structure_only_assert_valid(__FILE__, __LINE__);) 241 #undef PB_DS_STRUCT_ONLY_ASSERT_VALID 242 #undef PB_DS_CLASS_T_DEC 243 #undef PB_DS_CLASS_C_DEC 244 #undef PB_DS_RB_TREE_NAME 245 #undef PB_DS_RB_TREE_BASE_NAME 246 #undef PB_DS_RB_TREE_BASE
GNU extensions for policy-based data structures for public use.
Struct holding two objects of arbitrary type.