Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/intrusive/rbtree.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 |
---|---|
1 ///////////////////////////////////////////////////////////////////////////// | 1 ///////////////////////////////////////////////////////////////////////////// |
2 // | 2 // |
3 // (C) Copyright Ion Gaztanaga 2006-2013 | 3 // (C) Copyright Ion Gaztanaga 2006-2014 |
4 // | 4 // |
5 // Distributed under the Boost Software License, Version 1.0. | 5 // Distributed under the Boost Software License, Version 1.0. |
6 // (See accompanying file LICENSE_1_0.txt or copy at | 6 // (See accompanying file LICENSE_1_0.txt or copy at |
7 // http://www.boost.org/LICENSE_1_0.txt) | 7 // http://www.boost.org/LICENSE_1_0.txt) |
8 // | 8 // |
11 ///////////////////////////////////////////////////////////////////////////// | 11 ///////////////////////////////////////////////////////////////////////////// |
12 #ifndef BOOST_INTRUSIVE_RBTREE_HPP | 12 #ifndef BOOST_INTRUSIVE_RBTREE_HPP |
13 #define BOOST_INTRUSIVE_RBTREE_HPP | 13 #define BOOST_INTRUSIVE_RBTREE_HPP |
14 | 14 |
15 #include <boost/intrusive/detail/config_begin.hpp> | 15 #include <boost/intrusive/detail/config_begin.hpp> |
16 #include <boost/intrusive/intrusive_fwd.hpp> | |
16 #include <cstddef> | 17 #include <cstddef> |
17 #include <functional> | 18 #include <boost/intrusive/detail/minimal_less_equal_header.hpp> |
18 #include <utility> | 19 #include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair |
19 | 20 |
20 #include <boost/intrusive/detail/assert.hpp> | |
21 #include <boost/static_assert.hpp> | |
22 #include <boost/intrusive/intrusive_fwd.hpp> | |
23 #include <boost/intrusive/set_hook.hpp> | 21 #include <boost/intrusive/set_hook.hpp> |
24 #include <boost/intrusive/detail/rbtree_node.hpp> | 22 #include <boost/intrusive/detail/rbtree_node.hpp> |
25 #include <boost/intrusive/bstree.hpp> | 23 #include <boost/intrusive/bstree.hpp> |
26 #include <boost/intrusive/detail/tree_node.hpp> | 24 #include <boost/intrusive/detail/tree_node.hpp> |
27 #include <boost/intrusive/detail/ebo_functor_holder.hpp> | |
28 #include <boost/intrusive/detail/mpl.hpp> | 25 #include <boost/intrusive/detail/mpl.hpp> |
29 #include <boost/intrusive/pointer_traits.hpp> | 26 #include <boost/intrusive/pointer_traits.hpp> |
30 #include <boost/intrusive/detail/function_detector.hpp> | 27 #include <boost/intrusive/detail/get_value_traits.hpp> |
31 #include <boost/intrusive/detail/utilities.hpp> | |
32 #include <boost/intrusive/options.hpp> | |
33 #include <boost/intrusive/rbtree_algorithms.hpp> | 28 #include <boost/intrusive/rbtree_algorithms.hpp> |
34 #include <boost/intrusive/link_mode.hpp> | 29 #include <boost/intrusive/link_mode.hpp> |
35 #include <boost/move/move.hpp> | 30 |
31 #include <boost/move/utility_core.hpp> | |
32 #include <boost/static_assert.hpp> | |
33 | |
34 #if defined(BOOST_HAS_PRAGMA_ONCE) | |
35 # pragma once | |
36 #endif | |
36 | 37 |
37 namespace boost { | 38 namespace boost { |
38 namespace intrusive { | 39 namespace intrusive { |
39 | 40 |
40 /// @cond | 41 /// @cond |
41 | 42 |
43 struct default_rbtree_hook_applier | |
44 { template <class T> struct apply{ typedef typename T::default_rbtree_hook type; }; }; | |
45 | |
46 template<> | |
47 struct is_default_hook_tag<default_rbtree_hook_applier> | |
48 { static const bool value = true; }; | |
49 | |
42 struct rbtree_defaults | 50 struct rbtree_defaults |
43 { | 51 { |
44 typedef detail::default_rbtree_hook proto_value_traits; | 52 typedef default_rbtree_hook_applier proto_value_traits; |
45 static const bool constant_time_size = true; | 53 static const bool constant_time_size = true; |
46 typedef std::size_t size_type; | 54 typedef std::size_t size_type; |
47 typedef void compare; | 55 typedef void compare; |
56 typedef void header_holder_type; | |
48 }; | 57 }; |
49 | 58 |
50 /// @endcond | 59 /// @endcond |
51 | 60 |
52 //! The class template rbtree is an intrusive red-black tree container, that | 61 //! The class template rbtree is an intrusive red-black tree container, that |
63 //! \c constant_time_size<>, \c size_type<> and | 72 //! \c constant_time_size<>, \c size_type<> and |
64 //! \c compare<>. | 73 //! \c compare<>. |
65 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) | 74 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) |
66 template<class T, class ...Options> | 75 template<class T, class ...Options> |
67 #else | 76 #else |
68 template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize> | 77 template<class ValueTraits, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder> |
69 #endif | 78 #endif |
70 class rbtree_impl | 79 class rbtree_impl |
71 /// @cond | 80 /// @cond |
72 : public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, RbTreeAlgorithms> | 81 : public bstree_impl<ValueTraits, VoidOrKeyComp, SizeType, ConstantTimeSize, RbTreeAlgorithms, HeaderHolder> |
73 /// @endcond | 82 /// @endcond |
74 { | 83 { |
75 public: | 84 public: |
76 typedef ValueTraits value_traits; | 85 typedef ValueTraits value_traits; |
77 /// @cond | 86 /// @cond |
78 typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType | 87 typedef bstree_impl< ValueTraits, VoidOrKeyComp, SizeType |
79 , ConstantTimeSize, RbTreeAlgorithms> tree_type; | 88 , ConstantTimeSize, RbTreeAlgorithms |
89 , HeaderHolder> tree_type; | |
80 typedef tree_type implementation_defined; | 90 typedef tree_type implementation_defined; |
81 /// @endcond | 91 /// @endcond |
82 | 92 |
83 typedef typename implementation_defined::pointer pointer; | 93 typedef typename implementation_defined::pointer pointer; |
84 typedef typename implementation_defined::const_pointer const_pointer; | 94 typedef typename implementation_defined::const_pointer const_pointer; |
127 : tree_type(unique, b, e, cmp, v_traits) | 137 : tree_type(unique, b, e, cmp, v_traits) |
128 {} | 138 {} |
129 | 139 |
130 //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&) | 140 //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&) |
131 rbtree_impl(BOOST_RV_REF(rbtree_impl) x) | 141 rbtree_impl(BOOST_RV_REF(rbtree_impl) x) |
132 : tree_type(::boost::move(static_cast<tree_type&>(x))) | 142 : tree_type(BOOST_MOVE_BASE(tree_type, x)) |
133 {} | 143 {} |
134 | 144 |
135 //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&) | 145 //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&) |
136 rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x) | 146 rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x) |
137 { return static_cast<rbtree_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); } | 147 { return static_cast<rbtree_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); } |
138 | 148 |
139 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED | 149 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED |
140 //! @copydoc ::boost::intrusive::bstree::~bstree() | 150 //! @copydoc ::boost::intrusive::bstree::~bstree() |
141 ~rbtree_impl(); | 151 ~rbtree_impl(); |
142 | 152 |
201 size_type size() const; | 211 size_type size() const; |
202 | 212 |
203 //! @copydoc ::boost::intrusive::bstree::swap | 213 //! @copydoc ::boost::intrusive::bstree::swap |
204 void swap(rbtree_impl& other); | 214 void swap(rbtree_impl& other); |
205 | 215 |
206 //! @copydoc ::boost::intrusive::bstree::clone_from | 216 //! @copydoc ::boost::intrusive::bstree::clone_from(const bstree &src, cloner, Disposer) |
207 template <class Cloner, class Disposer> | 217 template <class Cloner, class Disposer> |
208 void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer); | 218 void clone_from(const rbtree_impl &src, Cloner cloner, Disposer disposer); |
219 | |
220 //! @copydoc ::boost::intrusive::bstree::clone_from(bstree &src, cloner, Disposer) | |
221 template <class Cloner, class Disposer> | |
222 void clone_from(rbtree_impl &src, Cloner cloner, Disposer disposer); | |
209 | 223 |
210 //! @copydoc ::boost::intrusive::bstree::insert_equal(reference) | 224 //! @copydoc ::boost::intrusive::bstree::insert_equal(reference) |
211 iterator insert_equal(reference value); | 225 iterator insert_equal(reference value); |
212 | 226 |
213 //! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference) | 227 //! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference) |
290 size_type count(const_reference value) const; | 304 size_type count(const_reference value) const; |
291 | 305 |
292 //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const | 306 //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyValueCompare)const |
293 template<class KeyType, class KeyValueCompare> | 307 template<class KeyType, class KeyValueCompare> |
294 size_type count(const KeyType& key, KeyValueCompare comp) const; | 308 size_type count(const KeyType& key, KeyValueCompare comp) const; |
295 | 309 |
296 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference) | 310 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference) |
297 iterator lower_bound(const_reference value); | 311 iterator lower_bound(const_reference value); |
298 | 312 |
299 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare) | 313 //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyValueCompare) |
300 template<class KeyType, class KeyValueCompare> | 314 template<class KeyType, class KeyValueCompare> |
301 iterator lower_bound(const KeyType& key, KeyValueCompare comp); | 315 iterator lower_bound(const KeyType& key, KeyValueCompare comp); |
302 | 316 |
303 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const | 317 //! @copydoc ::boost::intrusive::bstree::lower_bound(const_reference)const |
424 //! same options (either explicitly or implicitly) are used. | 438 //! same options (either explicitly or implicitly) are used. |
425 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | 439 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) |
426 template<class T, class ...Options> | 440 template<class T, class ...Options> |
427 #else | 441 #else |
428 template<class T, class O1 = void, class O2 = void | 442 template<class T, class O1 = void, class O2 = void |
429 , class O3 = void, class O4 = void> | 443 , class O3 = void, class O4 = void |
444 , class O5 = void> | |
430 #endif | 445 #endif |
431 struct make_rbtree | 446 struct make_rbtree |
432 { | 447 { |
433 /// @cond | 448 /// @cond |
434 typedef typename pack_options | 449 typedef typename pack_options |
435 < rbtree_defaults, | 450 < rbtree_defaults, |
436 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | 451 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) |
437 O1, O2, O3, O4 | 452 O1, O2, O3, O4, O5 |
438 #else | 453 #else |
439 Options... | 454 Options... |
440 #endif | 455 #endif |
441 >::type packed_options; | 456 >::type packed_options; |
442 | 457 |
446 typedef rbtree_impl | 461 typedef rbtree_impl |
447 < value_traits | 462 < value_traits |
448 , typename packed_options::compare | 463 , typename packed_options::compare |
449 , typename packed_options::size_type | 464 , typename packed_options::size_type |
450 , packed_options::constant_time_size | 465 , packed_options::constant_time_size |
466 , typename packed_options::header_holder_type | |
451 > implementation_defined; | 467 > implementation_defined; |
452 /// @endcond | 468 /// @endcond |
453 typedef implementation_defined type; | 469 typedef implementation_defined type; |
454 }; | 470 }; |
455 | 471 |
456 | 472 |
457 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED | 473 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED |
458 | 474 |
459 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | 475 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) |
460 template<class T, class O1, class O2, class O3, class O4> | 476 template<class T, class O1, class O2, class O3, class O4, class O5> |
461 #else | 477 #else |
462 template<class T, class ...Options> | 478 template<class T, class ...Options> |
463 #endif | 479 #endif |
464 class rbtree | 480 class rbtree |
465 : public make_rbtree<T, | 481 : public make_rbtree<T, |
466 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | 482 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) |
467 O1, O2, O3, O4 | 483 O1, O2, O3, O4, O5 |
468 #else | 484 #else |
469 Options... | 485 Options... |
470 #endif | 486 #endif |
471 >::type | 487 >::type |
472 { | 488 { |
473 typedef typename make_rbtree | 489 typedef typename make_rbtree |
474 <T, | 490 <T, |
475 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) | 491 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES) |
476 O1, O2, O3, O4 | 492 O1, O2, O3, O4, O5 |
477 #else | 493 #else |
478 Options... | 494 Options... |
479 #endif | 495 #endif |
480 >::type Base; | 496 >::type Base; |
481 BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree) | 497 BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree) |
482 | 498 |
483 public: | 499 public: |
484 typedef typename Base::value_compare value_compare; | 500 typedef typename Base::value_compare value_compare; |
485 typedef typename Base::value_traits value_traits; | 501 typedef typename Base::value_traits value_traits; |
486 typedef typename Base::real_value_traits real_value_traits; | |
487 typedef typename Base::iterator iterator; | 502 typedef typename Base::iterator iterator; |
488 typedef typename Base::const_iterator const_iterator; | 503 typedef typename Base::const_iterator const_iterator; |
489 typedef typename Base::reverse_iterator reverse_iterator; | 504 typedef typename Base::reverse_iterator reverse_iterator; |
490 typedef typename Base::const_reverse_iterator const_reverse_iterator; | 505 typedef typename Base::const_reverse_iterator const_reverse_iterator; |
491 | 506 |
492 //Assert if passed value traits are compatible with the type | 507 //Assert if passed value traits are compatible with the type |
493 BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value)); | 508 BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value)); |
494 | 509 |
495 explicit rbtree( const value_compare &cmp = value_compare() | 510 explicit rbtree( const value_compare &cmp = value_compare() |
496 , const value_traits &v_traits = value_traits()) | 511 , const value_traits &v_traits = value_traits()) |
497 : Base(cmp, v_traits) | 512 : Base(cmp, v_traits) |
498 {} | 513 {} |
503 , const value_traits &v_traits = value_traits()) | 518 , const value_traits &v_traits = value_traits()) |
504 : Base(unique, b, e, cmp, v_traits) | 519 : Base(unique, b, e, cmp, v_traits) |
505 {} | 520 {} |
506 | 521 |
507 rbtree(BOOST_RV_REF(rbtree) x) | 522 rbtree(BOOST_RV_REF(rbtree) x) |
508 : Base(::boost::move(static_cast<Base&>(x))) | 523 : Base(BOOST_MOVE_BASE(Base, x)) |
509 {} | 524 {} |
510 | 525 |
511 rbtree& operator=(BOOST_RV_REF(rbtree) x) | 526 rbtree& operator=(BOOST_RV_REF(rbtree) x) |
512 { return static_cast<rbtree &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } | 527 { return static_cast<rbtree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } |
513 | 528 |
514 static rbtree &container_from_end_iterator(iterator end_iterator) | 529 static rbtree &container_from_end_iterator(iterator end_iterator) |
515 { return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); } | 530 { return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); } |
516 | 531 |
517 static const rbtree &container_from_end_iterator(const_iterator end_iterator) | 532 static const rbtree &container_from_end_iterator(const_iterator end_iterator) |