41 #ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP 42 #define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP 52 #define PB_DS_TREE_CONST_IT_C_DEC \ 53 bin_search_tree_const_it_< \ 60 Is_Forward_Iterator, \ 63 #define PB_DS_TREE_CONST_ODIR_IT_C_DEC \ 64 bin_search_tree_const_it_< \ 71 !Is_Forward_Iterator, \ 74 #define PB_DS_TREE_IT_C_DEC \ 75 bin_search_tree_it_< \ 82 Is_Forward_Iterator, \ 85 #define PB_DS_TREE_ODIR_IT_C_DEC \ 86 bin_search_tree_it_< \ 93 !Is_Forward_Iterator, \ 97 template<
typename Node_Pointer,
100 typename Const_Pointer,
102 typename Const_Reference,
103 bool Is_Forward_Iterator,
109 typedef typename _Alloc::difference_type difference_type;
110 typedef Value_Type value_type;
111 typedef Pointer pointer;
112 typedef Const_Pointer const_pointer;
113 typedef Reference reference;
114 typedef Const_Reference const_reference;
118 : m_p_nd(const_cast<Node_Pointer>(p_nd))
123 : m_p_nd(other.m_p_nd)
127 PB_DS_TREE_CONST_IT_C_DEC&
128 operator=(
const PB_DS_TREE_CONST_IT_C_DEC& other)
130 m_p_nd = other.m_p_nd;
135 PB_DS_TREE_CONST_IT_C_DEC&
136 operator=(
const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
138 m_p_nd = other.m_p_nd;
145 _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
146 return &m_p_nd->m_value;
149 inline const_reference
152 _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
153 return m_p_nd->m_value;
157 operator==(
const PB_DS_TREE_CONST_IT_C_DEC & other)
const 158 {
return m_p_nd == other.m_p_nd; }
161 operator==(
const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other)
const 162 {
return m_p_nd == other.m_p_nd; }
165 operator!=(
const PB_DS_TREE_CONST_IT_C_DEC& other)
const 166 {
return m_p_nd != other.m_p_nd; }
169 operator!=(
const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)
const 170 {
return m_p_nd != other.m_p_nd; }
172 inline PB_DS_TREE_CONST_IT_C_DEC&
175 _GLIBCXX_DEBUG_ASSERT(m_p_nd != 0);
176 inc(integral_constant<int,Is_Forward_Iterator>());
180 inline PB_DS_TREE_CONST_IT_C_DEC
183 PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
188 inline PB_DS_TREE_CONST_IT_C_DEC&
191 dec(integral_constant<int,Is_Forward_Iterator>());
195 inline PB_DS_TREE_CONST_IT_C_DEC
198 PB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);
211 if (m_p_nd->special()&&
212 m_p_nd->m_p_parent->m_p_parent == m_p_nd)
214 m_p_nd = m_p_nd->m_p_left;
218 if (m_p_nd->m_p_right != 0)
220 m_p_nd = m_p_nd->m_p_right;
221 while (m_p_nd->m_p_left != 0)
222 m_p_nd = m_p_nd->m_p_left;
226 Node_Pointer p_y = m_p_nd->m_p_parent;
227 while (m_p_nd == p_y->m_p_right)
230 p_y = p_y->m_p_parent;
233 if (m_p_nd->m_p_right != p_y)
244 if (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd)
246 m_p_nd = m_p_nd->m_p_right;
250 if (m_p_nd->m_p_left != 0)
252 Node_Pointer p_y = m_p_nd->m_p_left;
253 while (p_y->m_p_right != 0)
254 p_y = p_y->m_p_right;
259 Node_Pointer p_y = m_p_nd->m_p_parent;
260 while (m_p_nd == p_y->m_p_left)
263 p_y = p_y->m_p_parent;
265 if (m_p_nd->m_p_left != p_y)
274 template<
typename Node_Pointer,
277 typename Const_Pointer,
279 typename Const_Reference,
280 bool Is_Forward_Iterator,
287 : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)
292 : PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd)
297 operator=(
const PB_DS_TREE_IT_C_DEC& other)
299 base_it_type::m_p_nd = other.m_p_nd;
305 operator=(
const PB_DS_TREE_ODIR_IT_C_DEC& other)
307 base_it_type::m_p_nd = other.m_p_nd;
311 inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer
314 _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
315 return &base_it_type::m_p_nd->m_value;
318 inline typename PB_DS_TREE_CONST_IT_C_DEC::reference
321 _GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != 0);
322 return base_it_type::m_p_nd->m_value;
325 inline PB_DS_TREE_IT_C_DEC&
328 PB_DS_TREE_CONST_IT_C_DEC:: operator++();
332 inline PB_DS_TREE_IT_C_DEC
335 PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
340 inline PB_DS_TREE_IT_C_DEC&
343 PB_DS_TREE_CONST_IT_C_DEC:: operator--();
347 inline PB_DS_TREE_IT_C_DEC
350 PB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);
359 #undef PB_DS_TREE_CONST_IT_C_DEC 360 #undef PB_DS_TREE_CONST_ODIR_IT_C_DEC 361 #undef PB_DS_TREE_IT_C_DEC 362 #undef PB_DS_TREE_ODIR_IT_C_DEC GNU extensions for policy-based data structures for public use.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
Bidirectional iterators support a superset of forward iterator operations.