Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/intrusive/avltree.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 ///////////////////////////////////////////////////////////////////////////// | |
2 // | |
3 // (C) Copyright Ion Gaztanaga 2007-2013 | |
4 // | |
5 // Distributed under the Boost Software License, Version 1.0. | |
6 // (See accompanying file LICENSE_1_0.txt or copy at | |
7 // http://www.boost.org/LICENSE_1_0.txt) | |
8 // | |
9 // See http://www.boost.org/libs/intrusive for documentation. | |
10 // | |
11 ///////////////////////////////////////////////////////////////////////////// | |
12 #ifndef BOOST_INTRUSIVE_AVLTREE_HPP | |
13 #define BOOST_INTRUSIVE_AVLTREE_HPP | |
14 | |
15 #include <boost/intrusive/detail/config_begin.hpp> | |
16 #include <algorithm> | |
17 #include <cstddef> | |
18 #include <functional> | |
19 #include <iterator> | |
20 #include <utility> | |
21 | |
22 #include <boost/intrusive/detail/assert.hpp> | |
23 #include <boost/static_assert.hpp> | |
24 #include <boost/intrusive/intrusive_fwd.hpp> | |
25 #include <boost/intrusive/avl_set_hook.hpp> | |
26 #include <boost/intrusive/detail/avltree_node.hpp> | |
27 #include <boost/intrusive/bstree.hpp> | |
28 #include <boost/intrusive/detail/tree_node.hpp> | |
29 #include <boost/intrusive/detail/ebo_functor_holder.hpp> | |
30 #include <boost/intrusive/detail/mpl.hpp> | |
31 #include <boost/intrusive/pointer_traits.hpp> | |
32 #include <boost/intrusive/pointer_traits.hpp> | |
33 #include <boost/intrusive/options.hpp> | |
34 #include <boost/intrusive/detail/utilities.hpp> | |
35 #include <boost/intrusive/avltree_algorithms.hpp> | |
36 #include <boost/intrusive/link_mode.hpp> | |
37 #include <boost/move/move.hpp> | |
38 | |
39 namespace boost { | |
40 namespace intrusive { | |
41 | |
42 /// @cond | |
43 | |
44 struct avltree_defaults | |
45 { | |
46 typedef detail::default_avltree_hook proto_value_traits; | |
47 static const bool constant_time_size = true; | |
48 typedef std::size_t size_type; | |
49 typedef void compare; | |
50 }; | |
51 | |
52 /// @endcond | |
53 | |
54 //! The class template avltree is an intrusive AVL tree container, that | |
55 //! is used to construct intrusive avl_set and avl_multiset containers. | |
56 //! The no-throw guarantee holds only, if the value_compare object | |
57 //! doesn't throw. | |
58 //! | |
59 //! The template parameter \c T is the type to be managed by the container. | |
60 //! The user can specify additional options and if no options are provided | |
61 //! default options are used. | |
62 //! | |
63 //! The container supports the following options: | |
64 //! \c base_hook<>/member_hook<>/value_traits<>, | |
65 //! \c constant_time_size<>, \c size_type<> and | |
66 //! \c compare<>. | |
67 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) | |
68 template<class T, class ...Options> | |
69 #else | |
70 template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize> | |
71 #endif | |
72 class avltree_impl | |
73 /// @cond | |
74 : public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, AvlTreeAlgorithms> | |
75 /// @endcond | |
76 { | |
77 public: | |
78 typedef ValueTraits value_traits; | |
79 /// @cond | |
80 typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType | |
81 , ConstantTimeSize, AvlTreeAlgorithms> tree_type; | |
82 typedef tree_type implementation_defined; | |
83 /// @endcond | |
84 | |
85 typedef typename implementation_defined::pointer pointer; | |
86 typedef typename implementation_defined::const_pointer const_pointer; | |
87 typedef typename implementation_defined::value_type value_type; | |
88 typedef typename implementation_defined::key_type key_type; | |
89 typedef typename implementation_defined::reference reference; | |
90 typedef typename implementation_defined::const_reference const_reference; | |
91 typedef typename implementation_defined::difference_type difference_type; | |
92 typedef typename implementation_defined::size_type size_type; | |
93 typedef typename implementation_defined::value_compare value_compare; | |
94 typedef typename implementation_defined::key_compare key_compare; | |
95 typedef typename implementation_defined::iterator iterator; | |
96 typedef typename implementation_defined::const_iterator const_iterator; | |
97 typedef typename implementation_defined::reverse_iterator reverse_iterator; | |
98 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator; | |
99 typedef typename implementation_defined::node_traits node_traits; | |
100 typedef typename implementation_defined::node node; | |
101 typedef typename implementation_defined::node_ptr node_ptr; | |
102 typedef typename implementation_defined::const_node_ptr const_node_ptr; | |
103 typedef typename implementation_defined::node_algorithms node_algorithms; | |
104 | |
105 static const bool constant_time_size = implementation_defined::constant_time_size; | |
106 /// @cond | |
107 private: | |
108 | |
109 //noncopyable | |
110 BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl) | |
111 | |
112 /// @endcond | |
113 | |
114 public: | |
115 | |
116 typedef typename implementation_defined::insert_commit_data insert_commit_data; | |
117 | |
118 | |
119 //! @copydoc ::boost::intrusive::bstree::bstree(const value_compare &,const value_traits &) | |
120 explicit avltree_impl( const value_compare &cmp = value_compare() | |
121 , const value_traits &v_traits = value_traits()) | |
122 : tree_type(cmp, v_traits) | |
123 {} | |
124 | |
125 //! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const value_compare &,const value_traits &) | |
126 template<class Iterator> | |
127 avltree_impl( bool unique, Iterator b, Iterator e | |
128 , const value_compare &cmp = value_compare() | |
129 , const value_traits &v_traits = value_traits()) | |
130 : tree_type(unique, b, e, cmp, v_traits) | |
131 {} | |
132 | |
133 //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&) | |
134 avltree_impl(BOOST_RV_REF(avltree_impl) x) | |
135 : tree_type(::boost::move(static_cast<tree_type&>(x))) | |
136 {} | |
137 | |
138 //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&) | |
139 avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) | |
140 { return static_cast<avltree_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); } | |
141 | |
142 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED | |
143 | |
144 //! @copydoc ::boost::intrusive::bstree::~bstree() | |
145 ~avltree_impl(); | |
146 | |
147 //! @copydoc ::boost::intrusive::bstree::begin() | |
148 iterator begin(); | |
149 | |
150 //! @copydoc ::boost::intrusive::bstree::begin()const | |
151 const_iterator begin() const; | |
152 | |
153 //! @copydoc ::boost::intrusive::bstree::cbegin()const | |
154 const_iterator cbegin() const; | |
155 | |
156 //! @copydoc ::boost::intrusive::bstree::end() | |
157 iterator end(); | |
158 | |
159 //! @copydoc ::boost::intrusive::bstree::end()const | |
160 const_iterator end() const; | |
161 | |
162 //! @copydoc ::boost::intrusive::bstree::cend()const | |
163 const_iterator cend() const; | |
164 | |
165 //! @copydoc ::boost::intrusive::bstree::rbegin() | |
166 reverse_iterator rbegin(); | |
167 | |
168 //! @copydoc ::boost::intrusive::bstree::rbegin()const | |
169 const_reverse_iterator rbegin() const; | |
170 | |
171 //! @copydoc ::boost::intrusive::bstree::crbegin()const | |
172 const_reverse_iterator crbegin() const; | |
173 | |
174 //! @copydoc ::boost::intrusive::bstree::rend() | |
175 reverse_iterator rend(); | |
176 | |
177 //! @copydoc ::boost::intrusive::bstree::rend()const | |
178 const_reverse_iterator rend() const; | |
179 | |
180 //! @copydoc ::boost::intrusive::bstree::crend()const | |
181 const_reverse_iterator crend() const; | |
182 | |
183 //! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(iterator) | |
184 static avltree_impl &container_from_end_iterator(iterator end_iterator); | |
185 | |
186 //! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(const_iterator) | |
187 static const avltree_impl &container_from_end_iterator(const_iterator end_iterator); | |
188 | |
189 //! @copydoc ::boost::intrusive::bstree::container_from_iterator(iterator) | |
190 static avltree_impl &container_from_iterator(iterator it); | |
191 | |
192 //! @copydoc ::boost::intrusive::bstree::container_from_iterator(const_iterator) | |
193 static const avltree_impl &container_from_iterator(const_iterator it); | |
194 | |
195 //! @copydoc ::boost::intrusive::bstree::key_comp()const | |
196 key_compare key_comp() const; | |
197 | |
198 //! @copydoc ::boost::intrusive::bstree::value_comp()const | |
199 value_compare value_comp() const; | |
200 | |
201 //! @copydoc ::boost::intrusive::bstree::empty()const | |
202 bool empty() const; | |
203 | |
204 //! @copydoc ::boost::intrusive::bstree::size()const | |
205 size_type size() const; | |
206 | |
207 //! @copydoc ::boost::intrusive::bstree::swap | |
208 void swap(avltree_impl& other); | |
209 | |
210 //! @copydoc ::boost::intrusive::bstree::clone_from | |
211 template <class Cloner, class Disposer> | |
212 void clone_from(const avltree_impl &src, Cloner cloner, Disposer disposer); | |
213 | |
214 //! @copydoc ::boost::intrusive::bstree::insert_equal(reference) | |
215 iterator insert_equal(reference value); | |
216 | |
217 //! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference) | |
218 iterator insert_equal(const_iterator hint, reference value); | |
219 | |
220 //! @copydoc ::boost::intrusive::bstree::insert_equal(Iterator,Iterator) | |
221 template<class Iterator> | |
222 void insert_equal(Iterator b, Iterator e); | |
223 | |
224 //! @copydoc ::boost::intrusive::bstree::insert_unique(reference) | |
225 std::pair<iterator, bool> insert_unique(reference value); | |
226 | |
227 //! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference) | |
228 iterator insert_unique(const_iterator hint, reference value); | |
229 | |
230 //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyValueCompare,insert_commit_data&) | |
231 template<class KeyType, class KeyValueCompare> | |
232 std::pair<iterator, bool> insert_unique_check | |
233 (const KeyType &key, KeyValueCompare key_value_comp, insert_commit_data &commit_data); | |
234 | |
235 //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyValueCompare,insert_commit_data&) | |
236 template<class KeyType, class KeyValueCompare> | |
237 std::pair<iterator, bool> insert_unique_check | |
238 (const_iterator hint, const KeyType &key | |
239 ,KeyValueCompare key_value_comp, insert_commit_data &commit_data); | |
240 | |
241 //! @copydoc ::boost::intrusive::bstree::insert_unique_commit | |
242 iterator insert_unique_commit(reference value, const insert_commit_data &commit_data); | |
243 | |
244 //! @copydoc ::boost::intrusive::bstree::insert_unique(Iterator,Iterator) | |
245 template<class Iterator> | |
246 void insert_unique(Iterator b, Iterator e); | |
247 | |
248 //! @copydoc ::boost::intrusive::bstree::insert_before | |
249 iterator insert_before(const_iterator pos, reference value); | |
250 | |
251 //! @copydoc ::boost::intrusive::bstree::push_back | |
252 void push_back(reference value); | |
253 | |
254 //! @copydoc ::boost::intrusive::bstree::push_front | |
255 void push_front(reference value); | |
256 | |
257 //! @copydoc ::boost::intrusive::bstree::erase(const_iterator) | |
258 iterator erase(const_iterator i); | |
259 | |
260 //! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator) | |
261 iterator erase(const_iterator b, const_iterator e); | |
262 | |
263 //! @copydoc ::boost::intrusive::bstree::erase(const_reference) | |
264 size_type erase(const_reference value); | |
265 | |
266 //! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyValueCompare) | |
267 template<class KeyType, class KeyValueCompare> | |
268 size_type erase(const KeyType& key, KeyValueCompare comp); | |
269 | |
270 //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer) | |
271 template<class Disposer> | |
272 iterator erase_and_dispose(const_iterator i, Disposer disposer); | |
273 | |
274 //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,const_iterator,Disposer) | |
275 template<class Disposer> | |
276 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer); | |
277 | |
278 //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_reference, Disposer) | |
279 template<class Disposer> | |
280 size_type erase_and_dispose(const_reference value, Disposer disposer); | |
281 | |
282 //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyValueCompare,Disposer) | |
283 template<class KeyType, class KeyValueCompare, class Disposer> | |
284 size_type erase_and_dispose(const KeyType& key, KeyValueCompare comp, Disposer disposer); | |
285 | |
286 //! @copydoc ::boost::intrusive::bstree::clear | |
287 void clear(); | |
288 | |
289 //! @copydoc ::boost::intrusive::bstree::clear_and_dispose | |
290 template<class Disposer> | |
291 void clear_and_dispose(Disposer disposer); | |
292 | |
293 //! @copydoc ::boost::intrusive::bstree::count(const_reference)const | |
294 size_type count(const_reference value) const; | |
295 | |
296 //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const | |
297 template<class KeyType, class KeyValueCompare> | |
298 size_type count(const KeyType& key, KeyValueCompare comp) const; | |
299 | |
300 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference) | |
301 iterator lower_bound(const_reference value); | |
302 | |
303 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare) | |
304 template<class KeyType, class KeyValueCompare> | |
305 iterator lower_bound(const KeyType& key, KeyValueCompare comp); | |
306 | |
307 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const | |
308 const_iterator lower_bound(const_reference value) const; | |
309 | |
310 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)const | |
311 template<class KeyType, class KeyValueCompare> | |
312 const_iterator lower_bound(const KeyType& key, KeyValueCompare comp) const; | |
313 | |
314 //! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference) | |
315 iterator upper_bound(const_reference value); | |
316 | |
317 //! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare) | |
318 template<class KeyType, class KeyValueCompare> | |
319 iterator upper_bound(const KeyType& key, KeyValueCompare comp); | |
320 | |
321 //! @copydoc ::boost::intrusive::bstree::upper_bound(const_reference)const | |
322 const_iterator upper_bound(const_reference value) const; | |
323 | |
324 //! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyValueCompare)const | |
325 template<class KeyType, class KeyValueCompare> | |
326 const_iterator upper_bound(const KeyType& key, KeyValueCompare comp) const; | |
327 | |
328 //! @copydoc ::boost::intrusive::bstree::find(const_reference) | |
329 iterator find(const_reference value); | |
330 | |
331 //! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare) | |
332 template<class KeyType, class KeyValueCompare> | |
333 iterator find(const KeyType& key, KeyValueCompare comp); | |
334 | |
335 //! @copydoc ::boost::intrusive::bstree::find(const_reference)const | |
336 const_iterator find(const_reference value) const; | |
337 | |
338 //! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyValueCompare)const | |
339 template<class KeyType, class KeyValueCompare> | |
340 const_iterator find(const KeyType& key, KeyValueCompare comp) const; | |
341 | |
342 //! @copydoc ::boost::intrusive::bstree::equal_range(const_reference) | |
343 std::pair<iterator,iterator> equal_range(const_reference value); | |
344 | |
345 //! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare) | |
346 template<class KeyType, class KeyValueCompare> | |
347 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyValueCompare comp); | |
348 | |
349 //! @copydoc ::boost::intrusive::bstree::equal_range(const_reference)const | |
350 std::pair<const_iterator, const_iterator> | |
351 equal_range(const_reference value) const; | |
352 | |
353 //! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyValueCompare)const | |
354 template<class KeyType, class KeyValueCompare> | |
355 std::pair<const_iterator, const_iterator> | |
356 equal_range(const KeyType& key, KeyValueCompare comp) const; | |
357 | |
358 //! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool) | |
359 std::pair<iterator,iterator> bounded_range | |
360 (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed); | |
361 | |
362 //! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool) | |
363 template<class KeyType, class KeyValueCompare> | |
364 std::pair<iterator,iterator> bounded_range | |
365 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed); | |
366 | |
367 //! @copydoc ::boost::intrusive::bstree::bounded_range(const_reference,const_reference,bool,bool)const | |
368 std::pair<const_iterator, const_iterator> | |
369 bounded_range(const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const; | |
370 | |
371 //! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyValueCompare,bool,bool)const | |
372 template<class KeyType, class KeyValueCompare> | |
373 std::pair<const_iterator, const_iterator> bounded_range | |
374 (const KeyType& lower_key, const KeyType& upper_key, KeyValueCompare comp, bool left_closed, bool right_closed) const; | |
375 | |
376 //! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference) | |
377 static iterator s_iterator_to(reference value); | |
378 | |
379 //! @copydoc ::boost::intrusive::bstree::s_iterator_to(const_reference) | |
380 static const_iterator s_iterator_to(const_reference value); | |
381 | |
382 //! @copydoc ::boost::intrusive::bstree::iterator_to(reference) | |
383 iterator iterator_to(reference value); | |
384 | |
385 //! @copydoc ::boost::intrusive::bstree::iterator_to(const_reference)const | |
386 const_iterator iterator_to(const_reference value) const; | |
387 | |
388 //! @copydoc ::boost::intrusive::bstree::init_node(reference) | |
389 static void init_node(reference value); | |
390 | |
391 //! @copydoc ::boost::intrusive::bstree::unlink_leftmost_without_rebalance | |
392 pointer unlink_leftmost_without_rebalance(); | |
393 | |
394 //! @copydoc ::boost::intrusive::bstree::replace_node | |
395 void replace_node(iterator replace_this, reference with_this); | |
396 | |
397 //! @copydoc ::boost::intrusive::bstree::remove_node | |
398 void remove_node(reference value); | |
399 #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED | |
400 }; | |
401 | |
402 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) | |
403 | |
404 template<class T, class ...Options> | |
405 bool operator< (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
406 | |
407 template<class T, class ...Options> | |
408 bool operator==(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
409 | |
410 template<class T, class ...Options> | |
411 bool operator!= (const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
412 | |
413 template<class T, class ...Options> | |
414 bool operator>(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
415 | |
416 template<class T, class ...Options> | |
417 bool operator<=(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
418 | |
419 template<class T, class ...Options> | |
420 bool operator>=(const avltree_impl<T, Options...> &x, const avltree_impl<T, Options...> &y); | |
421 | |
422 template<class T, class ...Options> | |
423 void swap(avltree_impl<T, Options...> &x, avltree_impl<T, Options...> &y); | |
424 | |
425 #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) | |
426 | |
427 //! Helper metafunction to define a \c avltree that yields to the same type when the | |
428 //! same options (either explicitly or implicitly) are used. | |
429 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | |
430 template<class T, class ...Options> | |
431 #else | |
432 template<class T, class O1 = void, class O2 = void | |
433 , class O3 = void, class O4 = void> | |
434 #endif | |
435 struct make_avltree | |
436 { | |
437 /// @cond | |
438 typedef typename pack_options | |
439 < avltree_defaults, | |
440 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | |
441 O1, O2, O3, O4 | |
442 #else | |
443 Options... | |
444 #endif | |
445 >::type packed_options; | |
446 | |
447 typedef typename detail::get_value_traits | |
448 <T, typename packed_options::proto_value_traits>::type value_traits; | |
449 | |
450 typedef avltree_impl | |
451 < value_traits | |
452 , typename packed_options::compare | |
453 , typename packed_options::size_type | |
454 , packed_options::constant_time_size | |
455 > implementation_defined; | |
456 /// @endcond | |
457 typedef implementation_defined type; | |
458 }; | |
459 | |
460 | |
461 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED | |
462 | |
463 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | |
464 template<class T, class O1, class O2, class O3, class O4> | |
465 #else | |
466 template<class T, class ...Options> | |
467 #endif | |
468 class avltree | |
469 : public make_avltree<T, | |
470 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | |
471 O1, O2, O3, O4 | |
472 #else | |
473 Options... | |
474 #endif | |
475 >::type | |
476 { | |
477 typedef typename make_avltree | |
478 <T, | |
479 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | |
480 O1, O2, O3, O4 | |
481 #else | |
482 Options... | |
483 #endif | |
484 >::type Base; | |
485 BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree) | |
486 | |
487 public: | |
488 typedef typename Base::value_compare value_compare; | |
489 typedef typename Base::value_traits value_traits; | |
490 typedef typename Base::real_value_traits real_value_traits; | |
491 typedef typename Base::iterator iterator; | |
492 typedef typename Base::const_iterator const_iterator; | |
493 typedef typename Base::reverse_iterator reverse_iterator; | |
494 typedef typename Base::const_reverse_iterator const_reverse_iterator; | |
495 | |
496 //Assert if passed value traits are compatible with the type | |
497 BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value)); | |
498 | |
499 explicit avltree( const value_compare &cmp = value_compare() | |
500 , const value_traits &v_traits = value_traits()) | |
501 : Base(cmp, v_traits) | |
502 {} | |
503 | |
504 template<class Iterator> | |
505 avltree( bool unique, Iterator b, Iterator e | |
506 , const value_compare &cmp = value_compare() | |
507 , const value_traits &v_traits = value_traits()) | |
508 : Base(unique, b, e, cmp, v_traits) | |
509 {} | |
510 | |
511 avltree(BOOST_RV_REF(avltree) x) | |
512 : Base(::boost::move(static_cast<Base&>(x))) | |
513 {} | |
514 | |
515 avltree& operator=(BOOST_RV_REF(avltree) x) | |
516 { return static_cast<avltree &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } | |
517 | |
518 static avltree &container_from_end_iterator(iterator end_iterator) | |
519 { return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); } | |
520 | |
521 static const avltree &container_from_end_iterator(const_iterator end_iterator) | |
522 { return static_cast<const avltree &>(Base::container_from_end_iterator(end_iterator)); } | |
523 | |
524 static avltree &container_from_iterator(iterator it) | |
525 { return static_cast<avltree &>(Base::container_from_iterator(it)); } | |
526 | |
527 static const avltree &container_from_iterator(const_iterator it) | |
528 { return static_cast<const avltree &>(Base::container_from_iterator(it)); } | |
529 }; | |
530 | |
531 #endif | |
532 | |
533 } //namespace intrusive | |
534 } //namespace boost | |
535 | |
536 #include <boost/intrusive/detail/config_end.hpp> | |
537 | |
538 #endif //BOOST_INTRUSIVE_AVLTREE_HPP |