comparison DEPENDENCIES/generic/include/boost/intrusive/avltree.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
11 ///////////////////////////////////////////////////////////////////////////// 11 /////////////////////////////////////////////////////////////////////////////
12 #ifndef BOOST_INTRUSIVE_AVLTREE_HPP 12 #ifndef BOOST_INTRUSIVE_AVLTREE_HPP
13 #define BOOST_INTRUSIVE_AVLTREE_HPP 13 #define BOOST_INTRUSIVE_AVLTREE_HPP
14 14
15 #include <boost/intrusive/detail/config_begin.hpp> 15 #include <boost/intrusive/detail/config_begin.hpp>
16 #include <algorithm> 16 #include <boost/intrusive/intrusive_fwd.hpp>
17 #include <cstddef> 17 #include <cstddef>
18 #include <functional> 18 #include <boost/intrusive/detail/minimal_less_equal_header.hpp>
19 #include <iterator> 19 #include <boost/intrusive/detail/minimal_pair_header.hpp>
20 #include <utility> 20
21
22 #include <boost/intrusive/detail/assert.hpp>
23 #include <boost/static_assert.hpp> 21 #include <boost/static_assert.hpp>
24 #include <boost/intrusive/intrusive_fwd.hpp>
25 #include <boost/intrusive/avl_set_hook.hpp> 22 #include <boost/intrusive/avl_set_hook.hpp>
26 #include <boost/intrusive/detail/avltree_node.hpp> 23 #include <boost/intrusive/detail/avltree_node.hpp>
27 #include <boost/intrusive/bstree.hpp> 24 #include <boost/intrusive/bstree.hpp>
28 #include <boost/intrusive/detail/tree_node.hpp> 25 #include <boost/intrusive/detail/tree_node.hpp>
29 #include <boost/intrusive/detail/ebo_functor_holder.hpp> 26 #include <boost/intrusive/detail/ebo_functor_holder.hpp>
30 #include <boost/intrusive/detail/mpl.hpp> 27 #include <boost/intrusive/detail/mpl.hpp>
31 #include <boost/intrusive/pointer_traits.hpp> 28 #include <boost/intrusive/pointer_traits.hpp>
32 #include <boost/intrusive/pointer_traits.hpp> 29 #include <boost/intrusive/detail/get_value_traits.hpp>
33 #include <boost/intrusive/options.hpp>
34 #include <boost/intrusive/detail/utilities.hpp>
35 #include <boost/intrusive/avltree_algorithms.hpp> 30 #include <boost/intrusive/avltree_algorithms.hpp>
36 #include <boost/intrusive/link_mode.hpp> 31 #include <boost/intrusive/link_mode.hpp>
37 #include <boost/move/move.hpp> 32 #include <boost/move/utility_core.hpp>
33
34 #if defined(BOOST_HAS_PRAGMA_ONCE)
35 # pragma once
36 #endif
38 37
39 namespace boost { 38 namespace boost {
40 namespace intrusive { 39 namespace intrusive {
41 40
42 /// @cond 41 /// @cond
43 42
43 struct default_avltree_hook_applier
44 { template <class T> struct apply{ typedef typename T::default_avltree_hook type; }; };
45
46 template<>
47 struct is_default_hook_tag<default_avltree_hook_applier>
48 { static const bool value = true; };
49
44 struct avltree_defaults 50 struct avltree_defaults
45 { 51 {
46 typedef detail::default_avltree_hook proto_value_traits; 52 typedef default_avltree_hook_applier proto_value_traits;
47 static const bool constant_time_size = true; 53 static const bool constant_time_size = true;
48 typedef std::size_t size_type; 54 typedef std::size_t size_type;
49 typedef void compare; 55 typedef void compare;
56 typedef void header_holder_type;
50 }; 57 };
51 58
52 /// @endcond 59 /// @endcond
53 60
54 //! The class template avltree is an intrusive AVL tree container, that 61 //! The class template avltree is an intrusive AVL tree container, that
65 //! \c constant_time_size<>, \c size_type<> and 72 //! \c constant_time_size<>, \c size_type<> and
66 //! \c compare<>. 73 //! \c compare<>.
67 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) 74 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
68 template<class T, class ...Options> 75 template<class T, class ...Options>
69 #else 76 #else
70 template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize> 77 template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
71 #endif 78 #endif
72 class avltree_impl 79 class avltree_impl
73 /// @cond 80 /// @cond
74 : public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, AvlTreeAlgorithms> 81 : public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
75 /// @endcond 82 /// @endcond
76 { 83 {
77 public: 84 public:
78 typedef ValueTraits value_traits; 85 typedef ValueTraits value_traits;
79 /// @cond 86 /// @cond
80 typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType 87 typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType
81 , ConstantTimeSize, AvlTreeAlgorithms> tree_type; 88 , ConstantTimeSize, AvlTreeAlgorithms
89 , HeaderHolder> tree_type;
82 typedef tree_type implementation_defined; 90 typedef tree_type implementation_defined;
83 /// @endcond 91 /// @endcond
84 92
85 typedef typename implementation_defined::pointer pointer; 93 typedef typename implementation_defined::pointer pointer;
86 typedef typename implementation_defined::const_pointer const_pointer; 94 typedef typename implementation_defined::const_pointer const_pointer;
130 : tree_type(unique, b, e, cmp, v_traits) 138 : tree_type(unique, b, e, cmp, v_traits)
131 {} 139 {}
132 140
133 //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&) 141 //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&)
134 avltree_impl(BOOST_RV_REF(avltree_impl) x) 142 avltree_impl(BOOST_RV_REF(avltree_impl) x)
135 : tree_type(::boost::move(static_cast<tree_type&>(x))) 143 : tree_type(BOOST_MOVE_BASE(tree_type, x))
136 {} 144 {}
137 145
138 //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&) 146 //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&)
139 avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x) 147 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)))); } 148 { return static_cast<avltree_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
141 149
142 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED 150 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
143 151
144 //! @copydoc ::boost::intrusive::bstree::~bstree() 152 //! @copydoc ::boost::intrusive::bstree::~bstree()
145 ~avltree_impl(); 153 ~avltree_impl();
294 size_type count(const_reference value) const; 302 size_type count(const_reference value) const;
295 303
296 //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const 304 //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const
297 template<class KeyType, class KeyValueCompare> 305 template<class KeyType, class KeyValueCompare>
298 size_type count(const KeyType& key, KeyValueCompare comp) const; 306 size_type count(const KeyType& key, KeyValueCompare comp) const;
299 307
300 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference) 308 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)
301 iterator lower_bound(const_reference value); 309 iterator lower_bound(const_reference value);
302 310
303 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare) 311 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare)
304 template<class KeyType, class KeyValueCompare> 312 template<class KeyType, class KeyValueCompare>
305 iterator lower_bound(const KeyType& key, KeyValueCompare comp); 313 iterator lower_bound(const KeyType& key, KeyValueCompare comp);
306 314
307 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const 315 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const
428 //! same options (either explicitly or implicitly) are used. 436 //! same options (either explicitly or implicitly) are used.
429 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 437 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
430 template<class T, class ...Options> 438 template<class T, class ...Options>
431 #else 439 #else
432 template<class T, class O1 = void, class O2 = void 440 template<class T, class O1 = void, class O2 = void
433 , class O3 = void, class O4 = void> 441 , class O3 = void, class O4 = void
442 , class O5 = void>
434 #endif 443 #endif
435 struct make_avltree 444 struct make_avltree
436 { 445 {
437 /// @cond 446 /// @cond
438 typedef typename pack_options 447 typedef typename pack_options
439 < avltree_defaults, 448 < avltree_defaults,
440 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 449 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
441 O1, O2, O3, O4 450 O1, O2, O3, O4, O5
442 #else 451 #else
443 Options... 452 Options...
444 #endif 453 #endif
445 >::type packed_options; 454 >::type packed_options;
446 455
450 typedef avltree_impl 459 typedef avltree_impl
451 < value_traits 460 < value_traits
452 , typename packed_options::compare 461 , typename packed_options::compare
453 , typename packed_options::size_type 462 , typename packed_options::size_type
454 , packed_options::constant_time_size 463 , packed_options::constant_time_size
464 , typename packed_options::header_holder_type
455 > implementation_defined; 465 > implementation_defined;
456 /// @endcond 466 /// @endcond
457 typedef implementation_defined type; 467 typedef implementation_defined type;
458 }; 468 };
459 469
460 470
461 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED 471 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
462 472
463 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 473 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
464 template<class T, class O1, class O2, class O3, class O4> 474 template<class T, class O1, class O2, class O3, class O4, class O5>
465 #else 475 #else
466 template<class T, class ...Options> 476 template<class T, class ...Options>
467 #endif 477 #endif
468 class avltree 478 class avltree
469 : public make_avltree<T, 479 : public make_avltree<T,
470 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 480 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
471 O1, O2, O3, O4 481 O1, O2, O3, O4, O5
472 #else 482 #else
473 Options... 483 Options...
474 #endif 484 #endif
475 >::type 485 >::type
476 { 486 {
477 typedef typename make_avltree 487 typedef typename make_avltree
478 <T, 488 <T,
479 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) 489 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
480 O1, O2, O3, O4 490 O1, O2, O3, O4, O5
481 #else 491 #else
482 Options... 492 Options...
483 #endif 493 #endif
484 >::type Base; 494 >::type Base;
485 BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree) 495 BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree)
486 496
487 public: 497 public:
488 typedef typename Base::value_compare value_compare; 498 typedef typename Base::value_compare value_compare;
489 typedef typename Base::value_traits value_traits; 499 typedef typename Base::value_traits value_traits;
490 typedef typename Base::real_value_traits real_value_traits;
491 typedef typename Base::iterator iterator; 500 typedef typename Base::iterator iterator;
492 typedef typename Base::const_iterator const_iterator; 501 typedef typename Base::const_iterator const_iterator;
493 typedef typename Base::reverse_iterator reverse_iterator; 502 typedef typename Base::reverse_iterator reverse_iterator;
494 typedef typename Base::const_reverse_iterator const_reverse_iterator; 503 typedef typename Base::const_reverse_iterator const_reverse_iterator;
495 504
496 //Assert if passed value traits are compatible with the type 505 //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)); 506 BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
498 507
499 explicit avltree( const value_compare &cmp = value_compare() 508 explicit avltree( const value_compare &cmp = value_compare()
500 , const value_traits &v_traits = value_traits()) 509 , const value_traits &v_traits = value_traits())
501 : Base(cmp, v_traits) 510 : Base(cmp, v_traits)
502 {} 511 {}
507 , const value_traits &v_traits = value_traits()) 516 , const value_traits &v_traits = value_traits())
508 : Base(unique, b, e, cmp, v_traits) 517 : Base(unique, b, e, cmp, v_traits)
509 {} 518 {}
510 519
511 avltree(BOOST_RV_REF(avltree) x) 520 avltree(BOOST_RV_REF(avltree) x)
512 : Base(::boost::move(static_cast<Base&>(x))) 521 : Base(BOOST_MOVE_BASE(Base, x))
513 {} 522 {}
514 523
515 avltree& operator=(BOOST_RV_REF(avltree) x) 524 avltree& operator=(BOOST_RV_REF(avltree) x)
516 { return static_cast<avltree &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } 525 { return static_cast<avltree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
517 526
518 static avltree &container_from_end_iterator(iterator end_iterator) 527 static avltree &container_from_end_iterator(iterator end_iterator)
519 { return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); } 528 { return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); }
520 529
521 static const avltree &container_from_end_iterator(const_iterator end_iterator) 530 static const avltree &container_from_end_iterator(const_iterator end_iterator)