80 #ifdef PB_DS_DATA_TRUE_INDICATOR
81 # define PB_DS_S_TREE_NAME splay_tree_map
82 # define PB_DS_S_TREE_BASE_NAME bin_search_tree_map
85 #ifdef PB_DS_DATA_FALSE_INDICATOR
86 # define PB_DS_S_TREE_NAME splay_tree_set
87 # define PB_DS_S_TREE_BASE_NAME bin_search_tree_set
90 #define PB_DS_CLASS_T_DEC \
91 template<typename Key, typename Mapped, typename Cmp_Fn, \
92 typename Node_And_It_Traits, typename _Alloc>
94 #define PB_DS_CLASS_C_DEC \
95 PB_DS_S_TREE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
97 #define PB_DS_S_TREE_BASE \
98 PB_DS_S_TREE_BASE_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, _Alloc>
105 template<
typename Key,
typename Mapped,
typename Cmp_Fn,
106 typename Node_And_It_Traits,
typename _Alloc>
107 class PB_DS_S_TREE_NAME :
public PB_DS_S_TREE_BASE
110 typedef PB_DS_S_TREE_BASE base_type;
111 #ifdef _GLIBCXX_DEBUG
112 typedef base_type debug_base;
114 typedef typename base_type::node_pointer node_pointer;
118 typedef _Alloc allocator_type;
119 typedef typename _Alloc::size_type size_type;
120 typedef typename _Alloc::difference_type difference_type;
121 typedef Cmp_Fn cmp_fn;
122 typedef typename base_type::key_type key_type;
123 typedef typename base_type::key_pointer key_pointer;
124 typedef typename base_type::key_const_pointer key_const_pointer;
125 typedef typename base_type::key_reference key_reference;
126 typedef typename base_type::key_const_reference key_const_reference;
127 typedef typename base_type::mapped_type mapped_type;
128 typedef typename base_type::mapped_pointer mapped_pointer;
129 typedef typename base_type::mapped_const_pointer mapped_const_pointer;
130 typedef typename base_type::mapped_reference mapped_reference;
131 typedef typename base_type::mapped_const_reference mapped_const_reference;
132 typedef typename base_type::value_type value_type;
133 typedef typename base_type::pointer pointer;
134 typedef typename base_type::const_pointer const_pointer;
135 typedef typename base_type::reference reference;
136 typedef typename base_type::const_reference const_reference;
137 typedef typename base_type::point_iterator point_iterator;
138 typedef typename base_type::const_iterator point_const_iterator;
139 typedef typename base_type::iterator iterator;
140 typedef typename base_type::const_iterator const_iterator;
141 typedef typename base_type::reverse_iterator reverse_iterator;
142 typedef typename base_type::const_reverse_iterator const_reverse_iterator;
143 typedef typename base_type::node_update node_update;
147 PB_DS_S_TREE_NAME(
const Cmp_Fn&);
149 PB_DS_S_TREE_NAME(
const Cmp_Fn&,
const node_update&);
151 PB_DS_S_TREE_NAME(
const PB_DS_CLASS_C_DEC&);
154 swap(PB_DS_CLASS_C_DEC&);
156 template<
typename It>
158 copy_from_range(It, It);
164 insert(const_reference r_value);
166 inline mapped_reference
169 #ifdef PB_DS_DATA_TRUE_INDICATOR
170 _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
172 insert_leaf_imp(value_type(r_key, mapped_type()));
174 ins_pair.first.m_p_nd->m_special =
false;
175 _GLIBCXX_DEBUG_ONLY(base_type::assert_valid(__FILE__, __LINE__));
176 splay(ins_pair.first.m_p_nd);
177 _GLIBCXX_DEBUG_ONLY(assert_valid(__FILE__, __LINE__);)
178 return ins_pair.first.m_p_nd->m_value.second;
181 return base_type::s_null_type;
185 inline point_iterator
186 find(key_const_reference);
188 inline point_const_iterator
189 find(key_const_reference)
const;
192 erase(key_const_reference);
197 inline reverse_iterator
198 erase(reverse_iterator);
200 template<
typename Pred>
205 join(PB_DS_CLASS_C_DEC&);
208 split(key_const_reference, PB_DS_CLASS_C_DEC&);
212 insert_leaf_imp(const_reference);
215 find_imp(key_const_reference);
217 inline const node_pointer
218 find_imp(key_const_reference)
const;
220 #ifdef _GLIBCXX_DEBUG
222 assert_valid(
const char* file,
int line)
const;
225 assert_special_imp(
const node_pointer,
const char* file,
int line)
const;
232 splay_zig_zag_left(node_pointer, node_pointer, node_pointer);
235 splay_zig_zag_right(node_pointer, node_pointer, node_pointer);
238 splay_zig_zig_left(node_pointer, node_pointer, node_pointer);
241 splay_zig_zig_right(node_pointer, node_pointer, node_pointer);
244 splay_zz_start(node_pointer, node_pointer, node_pointer);
247 splay_zz_end(node_pointer, node_pointer, node_pointer);
250 leftmost(node_pointer);
253 erase_node(node_pointer);
256 #define PB_DS_ASSERT_BASE_NODE_CONSISTENT(_Node) \
257 _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(_Node, \
258 __FILE__, __LINE__);)
268 #undef PB_DS_ASSERT_BASE_NODE_CONSISTENT
269 #undef PB_DS_CLASS_T_DEC
270 #undef PB_DS_CLASS_C_DEC
271 #undef PB_DS_S_TREE_NAME
272 #undef PB_DS_S_TREE_BASE_NAME
273 #undef PB_DS_S_TREE_BASE
reference operator[](size_t __position)
Array-indexing support.
Struct holding two objects of arbitrary type.