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

source code of boost/libs/intrusive/include/boost/intrusive/avltree.hpp