File indexing completed on 2025-07-05 08:36:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_INTRUSIVE_AVL_SET_HPP
0013 #define BOOST_INTRUSIVE_AVL_SET_HPP
0014
0015 #include <boost/intrusive/detail/config_begin.hpp>
0016 #include <boost/intrusive/intrusive_fwd.hpp>
0017 #include <boost/intrusive/avltree.hpp>
0018 #include <boost/intrusive/detail/mpl.hpp>
0019 #include <boost/move/utility_core.hpp>
0020
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 # pragma once
0023 #endif
0024
0025 namespace boost {
0026 namespace intrusive {
0027
0028 #if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0029 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0030 class avl_multiset_impl;
0031 #endif
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0045 template<class T, class ...Options>
0046 #else
0047 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0048 #endif
0049 class avl_set_impl
0050 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0051 : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
0052 #endif
0053 {
0054
0055 typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
0056 BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set_impl)
0057
0058 typedef tree_type implementation_defined;
0059
0060
0061 public:
0062 typedef typename implementation_defined::value_type value_type;
0063 typedef typename implementation_defined::key_type key_type;
0064 typedef typename implementation_defined::key_of_value key_of_value;
0065 typedef typename implementation_defined::value_traits value_traits;
0066 typedef typename implementation_defined::pointer pointer;
0067 typedef typename implementation_defined::const_pointer const_pointer;
0068 typedef typename implementation_defined::reference reference;
0069 typedef typename implementation_defined::const_reference const_reference;
0070 typedef typename implementation_defined::difference_type difference_type;
0071 typedef typename implementation_defined::size_type size_type;
0072 typedef typename implementation_defined::value_compare value_compare;
0073 typedef typename implementation_defined::key_compare key_compare;
0074 typedef typename implementation_defined::iterator iterator;
0075 typedef typename implementation_defined::const_iterator const_iterator;
0076 typedef typename implementation_defined::reverse_iterator reverse_iterator;
0077 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
0078 typedef typename implementation_defined::insert_commit_data insert_commit_data;
0079 typedef typename implementation_defined::node_traits node_traits;
0080 typedef typename implementation_defined::node node;
0081 typedef typename implementation_defined::node_ptr node_ptr;
0082 typedef typename implementation_defined::const_node_ptr const_node_ptr;
0083 typedef typename implementation_defined::node_algorithms node_algorithms;
0084
0085 static const bool constant_time_size = tree_type::constant_time_size;
0086
0087 public:
0088
0089
0090 avl_set_impl()
0091 : tree_type()
0092 {}
0093
0094
0095 explicit avl_set_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
0096 : tree_type(cmp, v_traits)
0097 {}
0098
0099
0100 template<class Iterator>
0101 avl_set_impl( Iterator b, Iterator e
0102 , const key_compare &cmp = key_compare()
0103 , const value_traits &v_traits = value_traits())
0104 : tree_type(true, b, e, cmp, v_traits)
0105 {}
0106
0107
0108 avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
0109 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0110 {}
0111
0112
0113 avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
0114 { return static_cast<avl_set_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0115
0116 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0117
0118
0119 ~avl_set_impl();
0120
0121
0122 iterator begin() BOOST_NOEXCEPT;
0123
0124
0125 const_iterator begin() const BOOST_NOEXCEPT;
0126
0127
0128 const_iterator cbegin() const BOOST_NOEXCEPT;
0129
0130
0131 iterator end() BOOST_NOEXCEPT;
0132
0133
0134 const_iterator end() const BOOST_NOEXCEPT;
0135
0136
0137 const_iterator cend() const BOOST_NOEXCEPT;
0138
0139
0140 reverse_iterator avlegin();
0141
0142
0143 const_reverse_iterator avlegin() const;
0144
0145
0146 const_reverse_iterator crbegin() const BOOST_NOEXCEPT;
0147
0148
0149 reverse_iterator rend() BOOST_NOEXCEPT;
0150
0151
0152 const_reverse_iterator rend() const BOOST_NOEXCEPT;
0153
0154
0155 const_reverse_iterator crend() const BOOST_NOEXCEPT;
0156
0157
0158 iterator root() BOOST_NOEXCEPT;
0159
0160
0161 const_iterator root() const BOOST_NOEXCEPT;
0162
0163
0164 const_iterator croot() const BOOST_NOEXCEPT;
0165
0166
0167 static avl_set_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0168
0169
0170 static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0171
0172
0173 static avl_set_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0174
0175
0176 static const avl_set_impl &container_from_iterator(const_iterator it) BOOST_NOEXCEPT;
0177
0178
0179 key_compare key_comp() const;
0180
0181
0182 value_compare value_comp() const;
0183
0184
0185 bool empty() const BOOST_NOEXCEPT;
0186
0187
0188 size_type size() const BOOST_NOEXCEPT;
0189
0190
0191 void swap(avl_set_impl& other);
0192
0193
0194 template <class Cloner, class Disposer>
0195 void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer);
0196
0197 #else
0198
0199 using tree_type::clone_from;
0200
0201 #endif
0202
0203
0204 template <class Cloner, class Disposer>
0205 void clone_from(BOOST_RV_REF(avl_set_impl) src, Cloner cloner, Disposer disposer)
0206 { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
0207
0208
0209 std::pair<iterator, bool> insert(reference value)
0210 { return tree_type::insert_unique(value); }
0211
0212
0213 iterator insert(const_iterator hint, reference value)
0214 { return tree_type::insert_unique(hint, value); }
0215
0216
0217 std::pair<iterator, bool> insert_check
0218 (const key_type &key, insert_commit_data &commit_data)
0219 { return tree_type::insert_unique_check(key, commit_data); }
0220
0221
0222 std::pair<iterator, bool> insert_check
0223 (const_iterator hint, const key_type &key
0224 ,insert_commit_data &commit_data)
0225 { return tree_type::insert_unique_check(hint, key, commit_data); }
0226
0227
0228 template<class KeyType, class KeyTypeKeyCompare>
0229 std::pair<iterator, bool> insert_check
0230 (const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
0231 { return tree_type::insert_unique_check(key, comp, commit_data); }
0232
0233
0234 template<class KeyType, class KeyTypeKeyCompare>
0235 std::pair<iterator, bool> insert_check
0236 (const_iterator hint, const KeyType &key
0237 ,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
0238 { return tree_type::insert_unique_check(hint, key, comp, commit_data); }
0239
0240
0241 template<class Iterator>
0242 void insert(Iterator b, Iterator e)
0243 { tree_type::insert_unique(b, e); }
0244
0245
0246 iterator insert_commit(reference value, const insert_commit_data &commit_data) BOOST_NOEXCEPT
0247 { return tree_type::insert_unique_commit(value, commit_data); }
0248
0249 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0250
0251 iterator insert_before(const_iterator pos, reference value) BOOST_NOEXCEPT;
0252
0253
0254 void push_back(reference value) BOOST_NOEXCEPT;
0255
0256
0257 void push_front(reference value) BOOST_NOEXCEPT;
0258
0259
0260 iterator erase(const_iterator i) BOOST_NOEXCEPT;
0261
0262
0263 iterator erase(const_iterator b, const_iterator e) BOOST_NOEXCEPT;
0264
0265
0266 size_type erase(const key_type &key);
0267
0268
0269 template<class KeyType, class KeyTypeKeyCompare>
0270 size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
0271
0272
0273 template<class Disposer>
0274 iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT;
0275
0276
0277 template<class Disposer>
0278 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) BOOST_NOEXCEPT;
0279
0280
0281 template<class Disposer>
0282 size_type erase_and_dispose(const key_type &key, Disposer disposer);
0283
0284
0285 template<class KeyType, class KeyTypeKeyCompare, class Disposer>
0286 size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
0287
0288
0289 void clear() BOOST_NOEXCEPT;
0290
0291
0292 template<class Disposer>
0293 void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT;
0294
0295 #endif
0296
0297
0298 size_type count(const key_type &key) const
0299 { return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
0300
0301
0302 template<class KeyType, class KeyTypeKeyCompare>
0303 size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
0304 { return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
0305
0306 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0307
0308
0309 iterator lower_bound(const key_type &key);
0310
0311
0312 template<class KeyType, class KeyTypeKeyCompare>
0313 iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
0314
0315
0316 const_iterator lower_bound(const key_type &key) const;
0317
0318
0319 template<class KeyType, class KeyTypeKeyCompare>
0320 const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0321
0322
0323 iterator upper_bound(const key_type &key);
0324
0325
0326 template<class KeyType, class KeyTypeKeyCompare>
0327 iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
0328
0329
0330 const_iterator upper_bound(const key_type &key) const;
0331
0332
0333 template<class KeyType, class KeyTypeKeyCompare>
0334 const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0335
0336
0337 iterator find(const key_type &key);
0338
0339
0340 template<class KeyType, class KeyTypeKeyCompare>
0341 iterator find(const KeyType& key, KeyTypeKeyCompare comp);
0342
0343
0344 const_iterator find(const key_type &key) const;
0345
0346
0347 template<class KeyType, class KeyTypeKeyCompare>
0348 const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
0349
0350 #endif
0351
0352
0353 std::pair<iterator,iterator> equal_range(const key_type &key)
0354 { return this->tree_type::lower_bound_range(key); }
0355
0356
0357 template<class KeyType, class KeyTypeKeyCompare>
0358 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
0359 { return this->tree_type::equal_range(key, comp); }
0360
0361
0362 std::pair<const_iterator, const_iterator>
0363 equal_range(const key_type &key) const
0364 { return this->tree_type::lower_bound_range(key); }
0365
0366
0367 template<class KeyType, class KeyTypeKeyCompare>
0368 std::pair<const_iterator, const_iterator>
0369 equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
0370 { return this->tree_type::equal_range(key, comp); }
0371
0372 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0373
0374
0375 std::pair<iterator,iterator> bounded_range
0376 (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
0377
0378
0379 template<class KeyType, class KeyTypeKeyCompare>
0380 std::pair<iterator,iterator> bounded_range
0381 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
0382
0383
0384 std::pair<const_iterator, const_iterator>
0385 bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
0386
0387
0388 template<class KeyType, class KeyTypeKeyCompare>
0389 std::pair<const_iterator, const_iterator> bounded_range
0390 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
0391
0392
0393 static iterator s_iterator_to(reference value) BOOST_NOEXCEPT;
0394
0395
0396 static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT;
0397
0398
0399 iterator iterator_to(reference value) BOOST_NOEXCEPT;
0400
0401
0402 const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT;
0403
0404
0405 static void init_node(reference value) BOOST_NOEXCEPT;
0406
0407
0408 pointer unlink_leftmost_without_rebalance() BOOST_NOEXCEPT;
0409
0410
0411 void replace_node(iterator replace_this, reference with_this) BOOST_NOEXCEPT;
0412
0413
0414 void remove_node(reference value) BOOST_NOEXCEPT;
0415
0416
0417 template<class ...Options2>
0418 void merge(avl_set<T, Options2...> &source);
0419
0420
0421 template<class ...Options2>
0422 void merge(avl_multiset<T, Options2...> &source);
0423
0424 #else
0425
0426 template<class Compare2>
0427 void merge(avl_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0428 { return tree_type::merge_unique(source); }
0429
0430
0431 template<class Compare2>
0432 void merge(avl_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0433 { return tree_type::merge_unique(source); }
0434
0435 #endif
0436 };
0437
0438 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0439
0440 template<class T, class ...Options>
0441 bool operator!= (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
0442
0443 template<class T, class ...Options>
0444 bool operator>(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
0445
0446 template<class T, class ...Options>
0447 bool operator<=(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
0448
0449 template<class T, class ...Options>
0450 bool operator>=(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
0451
0452 template<class T, class ...Options>
0453 void swap(avl_set_impl<T, Options...> &x, avl_set_impl<T, Options...> &y);
0454
0455 #endif
0456
0457
0458
0459 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0460 template<class T, class ...Options>
0461 #else
0462 template<class T, class O1 = void, class O2 = void
0463 , class O3 = void, class O4 = void
0464 , class O5 = void, class O6 = void>
0465 #endif
0466 struct make_avl_set
0467 {
0468
0469 typedef typename pack_options
0470 < avltree_defaults,
0471 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0472 O1, O2, O3, O4, O5, O6
0473 #else
0474 Options...
0475 #endif
0476 >::type packed_options;
0477
0478 typedef typename detail::get_value_traits
0479 <T, typename packed_options::proto_value_traits>::type value_traits;
0480
0481 typedef avl_set_impl
0482 < value_traits
0483 , typename packed_options::key_of_value
0484 , typename packed_options::compare
0485 , typename packed_options::size_type
0486 , packed_options::constant_time_size
0487 , typename packed_options::header_holder_type
0488 > implementation_defined;
0489
0490 typedef implementation_defined type;
0491 };
0492
0493 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0494 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0495 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
0496 #else
0497 template<class T, class ...Options>
0498 #endif
0499 class avl_set
0500 : public make_avl_set<T,
0501 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0502 O1, O2, O3, O4, O5, O6
0503 #else
0504 Options...
0505 #endif
0506 >::type
0507 {
0508 typedef typename make_avl_set
0509 <T,
0510 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0511 O1, O2, O3, O4, O5, O6
0512 #else
0513 Options...
0514 #endif
0515 >::type Base;
0516
0517 BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set)
0518 public:
0519 typedef typename Base::key_compare key_compare;
0520 typedef typename Base::value_traits value_traits;
0521 typedef typename Base::iterator iterator;
0522 typedef typename Base::const_iterator const_iterator;
0523
0524
0525 BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
0526
0527 inline avl_set()
0528 : Base()
0529 {}
0530
0531 inline explicit avl_set( const key_compare &cmp, const value_traits &v_traits = value_traits())
0532 : Base(cmp, v_traits)
0533 {}
0534
0535 template<class Iterator>
0536 inline avl_set( Iterator b, Iterator e
0537 , const key_compare &cmp = key_compare()
0538 , const value_traits &v_traits = value_traits())
0539 : Base(b, e, cmp, v_traits)
0540 {}
0541
0542 inline avl_set(BOOST_RV_REF(avl_set) x)
0543 : Base(BOOST_MOVE_BASE(Base, x))
0544 {}
0545
0546 inline avl_set& operator=(BOOST_RV_REF(avl_set) x)
0547 { return static_cast<avl_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
0548
0549 template <class Cloner, class Disposer>
0550 inline void clone_from(const avl_set &src, Cloner cloner, Disposer disposer)
0551 { Base::clone_from(src, cloner, disposer); }
0552
0553 template <class Cloner, class Disposer>
0554 inline void clone_from(BOOST_RV_REF(avl_set) src, Cloner cloner, Disposer disposer)
0555 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
0556
0557 inline static avl_set &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
0558 { return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); }
0559
0560 inline static const avl_set &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
0561 { return static_cast<const avl_set &>(Base::container_from_end_iterator(end_iterator)); }
0562
0563 inline static avl_set &container_from_iterator(iterator it) BOOST_NOEXCEPT
0564 { return static_cast<avl_set &>(Base::container_from_iterator(it)); }
0565
0566 inline static const avl_set &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
0567 { return static_cast<const avl_set &>(Base::container_from_iterator(it)); }
0568 };
0569
0570 #endif
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0584 template<class T, class ...Options>
0585 #else
0586 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0587 #endif
0588 class avl_multiset_impl
0589 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0590 : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
0591 #endif
0592 {
0593
0594 typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
0595
0596 BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset_impl)
0597 typedef tree_type implementation_defined;
0598
0599
0600 public:
0601 typedef typename implementation_defined::value_type value_type;
0602 typedef typename implementation_defined::key_type key_type;
0603 typedef typename implementation_defined::key_of_value key_of_value;
0604 typedef typename implementation_defined::value_traits value_traits;
0605 typedef typename implementation_defined::pointer pointer;
0606 typedef typename implementation_defined::const_pointer const_pointer;
0607 typedef typename implementation_defined::reference reference;
0608 typedef typename implementation_defined::const_reference const_reference;
0609 typedef typename implementation_defined::difference_type difference_type;
0610 typedef typename implementation_defined::size_type size_type;
0611 typedef typename implementation_defined::value_compare value_compare;
0612 typedef typename implementation_defined::key_compare key_compare;
0613 typedef typename implementation_defined::iterator iterator;
0614 typedef typename implementation_defined::const_iterator const_iterator;
0615 typedef typename implementation_defined::reverse_iterator reverse_iterator;
0616 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
0617 typedef typename implementation_defined::insert_commit_data insert_commit_data;
0618 typedef typename implementation_defined::node_traits node_traits;
0619 typedef typename implementation_defined::node node;
0620 typedef typename implementation_defined::node_ptr node_ptr;
0621 typedef typename implementation_defined::const_node_ptr const_node_ptr;
0622 typedef typename implementation_defined::node_algorithms node_algorithms;
0623
0624 static const bool constant_time_size = tree_type::constant_time_size;
0625
0626 public:
0627
0628 avl_multiset_impl()
0629 : tree_type()
0630 {}
0631
0632
0633 explicit avl_multiset_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
0634 : tree_type(cmp, v_traits)
0635 {}
0636
0637
0638 template<class Iterator>
0639 avl_multiset_impl( Iterator b, Iterator e
0640 , const key_compare &cmp = key_compare()
0641 , const value_traits &v_traits = value_traits())
0642 : tree_type(false, b, e, cmp, v_traits)
0643 {}
0644
0645
0646 avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
0647 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0648 {}
0649
0650
0651 avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
0652 { return static_cast<avl_multiset_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0653
0654 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0655
0656 ~avl_multiset_impl();
0657
0658
0659 iterator begin() BOOST_NOEXCEPT;
0660
0661
0662 const_iterator begin() const BOOST_NOEXCEPT;
0663
0664
0665 const_iterator cbegin() const BOOST_NOEXCEPT;
0666
0667
0668 iterator end() BOOST_NOEXCEPT;
0669
0670
0671 const_iterator end() const BOOST_NOEXCEPT;
0672
0673
0674 const_iterator cend() const BOOST_NOEXCEPT;
0675
0676
0677 reverse_iterator rbegin() BOOST_NOEXCEPT;
0678
0679
0680 const_reverse_iterator rbegin() const BOOST_NOEXCEPT;
0681
0682
0683 const_reverse_iterator crbegin() const BOOST_NOEXCEPT;
0684
0685
0686 reverse_iterator rend() BOOST_NOEXCEPT;
0687
0688
0689 const_reverse_iterator rend() const BOOST_NOEXCEPT;
0690
0691
0692 const_reverse_iterator crend() const BOOST_NOEXCEPT;
0693
0694
0695 iterator root() BOOST_NOEXCEPT;
0696
0697
0698 const_iterator root() const BOOST_NOEXCEPT;
0699
0700
0701 const_iterator croot() const BOOST_NOEXCEPT;
0702
0703
0704 static avl_multiset_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0705
0706
0707 static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0708
0709
0710 static avl_multiset_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0711
0712
0713 static const avl_multiset_impl &container_from_iterator(const_iterator it) BOOST_NOEXCEPT;
0714
0715
0716 key_compare key_comp() const;
0717
0718
0719 value_compare value_comp() const;
0720
0721
0722 bool empty() const BOOST_NOEXCEPT;
0723
0724
0725 size_type size() const BOOST_NOEXCEPT;
0726
0727
0728 void swap(avl_multiset_impl& other);
0729
0730
0731 template <class Cloner, class Disposer>
0732 void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer);
0733
0734 #else
0735
0736 using tree_type::clone_from;
0737
0738 #endif
0739
0740
0741 template <class Cloner, class Disposer>
0742 void clone_from(BOOST_RV_REF(avl_multiset_impl) src, Cloner cloner, Disposer disposer)
0743 { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
0744
0745
0746 iterator insert(reference value)
0747 { return tree_type::insert_equal(value); }
0748
0749
0750 iterator insert(const_iterator hint, reference value)
0751 { return tree_type::insert_equal(hint, value); }
0752
0753
0754 template<class Iterator>
0755 void insert(Iterator b, Iterator e)
0756 { tree_type::insert_equal(b, e); }
0757
0758 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0759
0760 iterator insert_before(const_iterator pos, reference value) BOOST_NOEXCEPT;
0761
0762
0763 void push_back(reference value) BOOST_NOEXCEPT;
0764
0765
0766 void push_front(reference value) BOOST_NOEXCEPT;
0767
0768
0769 iterator erase(const_iterator i) BOOST_NOEXCEPT;
0770
0771
0772 iterator erase(const_iterator b, const_iterator e) BOOST_NOEXCEPT;
0773
0774
0775 size_type erase(const key_type &key);
0776
0777
0778 template<class KeyType, class KeyTypeKeyCompare>
0779 size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
0780
0781
0782 template<class Disposer>
0783 iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT;
0784
0785
0786 template<class Disposer>
0787 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) BOOST_NOEXCEPT;
0788
0789
0790 template<class Disposer>
0791 size_type erase_and_dispose(const key_type &key, Disposer disposer);
0792
0793
0794 template<class KeyType, class KeyTypeKeyCompare, class Disposer>
0795 size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
0796
0797
0798 void clear() BOOST_NOEXCEPT;
0799
0800
0801 template<class Disposer>
0802 void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT;
0803
0804
0805 size_type count(const key_type &key) const;
0806
0807
0808 template<class KeyType, class KeyTypeKeyCompare>
0809 size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
0810
0811
0812 iterator lower_bound(const key_type &key);
0813
0814
0815 template<class KeyType, class KeyTypeKeyCompare>
0816 iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
0817
0818
0819 const_iterator lower_bound(const key_type &key) const;
0820
0821
0822 template<class KeyType, class KeyTypeKeyCompare>
0823 const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0824
0825
0826 iterator upper_bound(const key_type &key);
0827
0828
0829 template<class KeyType, class KeyTypeKeyCompare>
0830 iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
0831
0832
0833 const_iterator upper_bound(const key_type &key) const;
0834
0835
0836 template<class KeyType, class KeyTypeKeyCompare>
0837 const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0838
0839
0840 iterator find(const key_type &key);
0841
0842
0843 template<class KeyType, class KeyTypeKeyCompare>
0844 iterator find(const KeyType& key, KeyTypeKeyCompare comp);
0845
0846
0847 const_iterator find(const key_type &key) const;
0848
0849
0850 template<class KeyType, class KeyTypeKeyCompare>
0851 const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
0852
0853
0854 std::pair<iterator,iterator> equal_range(const key_type &key);
0855
0856
0857 template<class KeyType, class KeyTypeKeyCompare>
0858 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
0859
0860
0861 std::pair<const_iterator, const_iterator>
0862 equal_range(const key_type &key) const;
0863
0864
0865 template<class KeyType, class KeyTypeKeyCompare>
0866 std::pair<const_iterator, const_iterator>
0867 equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
0868
0869
0870 std::pair<iterator,iterator> bounded_range
0871 (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
0872
0873
0874 template<class KeyType, class KeyTypeKeyCompare>
0875 std::pair<iterator,iterator> bounded_range
0876 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
0877
0878
0879 std::pair<const_iterator, const_iterator>
0880 bounded_range(const key_type &lower_key, const key_type &key upper_key, bool left_closed, bool right_closed) const;
0881
0882
0883 template<class KeyType, class KeyTypeKeyCompare>
0884 std::pair<const_iterator, const_iterator> bounded_range
0885 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
0886
0887
0888 static iterator s_iterator_to(reference value) BOOST_NOEXCEPT;
0889
0890
0891 static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT;
0892
0893
0894 iterator iterator_to(reference value) BOOST_NOEXCEPT;
0895
0896
0897 const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT;
0898
0899
0900 static void init_node(reference value) BOOST_NOEXCEPT;
0901
0902
0903 pointer unlink_leftmost_without_rebalance() BOOST_NOEXCEPT;
0904
0905
0906 void replace_node(iterator replace_this, reference with_this) BOOST_NOEXCEPT;
0907
0908
0909 void remove_node(reference value) BOOST_NOEXCEPT;
0910
0911
0912 template<class ...Options2>
0913 void merge(avl_multiset<T, Options2...> &source);
0914
0915
0916 template<class ...Options2>
0917 void merge(avl_set<T, Options2...> &source);
0918
0919 #else
0920
0921 template<class Compare2>
0922 void merge(avl_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0923 { return tree_type::merge_equal(source); }
0924
0925 template<class Compare2>
0926 void merge(avl_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0927 { return tree_type::merge_equal(source); }
0928
0929 #endif
0930 };
0931
0932 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0933
0934 template<class T, class ...Options>
0935 bool operator!= (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
0936
0937 template<class T, class ...Options>
0938 bool operator>(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
0939
0940 template<class T, class ...Options>
0941 bool operator<=(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
0942
0943 template<class T, class ...Options>
0944 bool operator>=(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
0945
0946 template<class T, class ...Options>
0947 void swap(avl_multiset_impl<T, Options...> &x, avl_multiset_impl<T, Options...> &y);
0948
0949 #endif
0950
0951
0952
0953 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0954 template<class T, class ...Options>
0955 #else
0956 template<class T, class O1 = void, class O2 = void
0957 , class O3 = void, class O4 = void
0958 , class O5 = void, class O6 = void>
0959 #endif
0960 struct make_avl_multiset
0961 {
0962
0963 typedef typename pack_options
0964 < avltree_defaults,
0965 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0966 O1, O2, O3, O4, O5, O6
0967 #else
0968 Options...
0969 #endif
0970 >::type packed_options;
0971
0972 typedef typename detail::get_value_traits
0973 <T, typename packed_options::proto_value_traits>::type value_traits;
0974
0975 typedef avl_multiset_impl
0976 < value_traits
0977 , typename packed_options::key_of_value
0978 , typename packed_options::compare
0979 , typename packed_options::size_type
0980 , packed_options::constant_time_size
0981 , typename packed_options::header_holder_type
0982 > implementation_defined;
0983
0984 typedef implementation_defined type;
0985 };
0986
0987 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0988
0989 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0990 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
0991 #else
0992 template<class T, class ...Options>
0993 #endif
0994 class avl_multiset
0995 : public make_avl_multiset<T,
0996 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0997 O1, O2, O3, O4, O5, O6
0998 #else
0999 Options...
1000 #endif
1001 >::type
1002 {
1003 typedef typename make_avl_multiset<T,
1004 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
1005 O1, O2, O3, O4, O5, O6
1006 #else
1007 Options...
1008 #endif
1009 >::type Base;
1010
1011 BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset)
1012
1013 public:
1014 typedef typename Base::key_compare key_compare;
1015 typedef typename Base::value_traits value_traits;
1016 typedef typename Base::iterator iterator;
1017 typedef typename Base::const_iterator const_iterator;
1018
1019
1020 BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
1021
1022 inline avl_multiset()
1023 : Base()
1024 {}
1025
1026 inline explicit avl_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits())
1027 : Base(cmp, v_traits)
1028 {}
1029
1030 template<class Iterator>
1031 inline avl_multiset( Iterator b, Iterator e
1032 , const key_compare &cmp = key_compare()
1033 , const value_traits &v_traits = value_traits())
1034 : Base(b, e, cmp, v_traits)
1035 {}
1036
1037 inline avl_multiset(BOOST_RV_REF(avl_multiset) x)
1038 : Base(BOOST_MOVE_BASE(Base, x))
1039 {}
1040
1041 inline avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x)
1042 { return static_cast<avl_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
1043
1044 template <class Cloner, class Disposer>
1045 inline void clone_from(const avl_multiset &src, Cloner cloner, Disposer disposer)
1046 { Base::clone_from(src, cloner, disposer); }
1047
1048 template <class Cloner, class Disposer>
1049 inline void clone_from(BOOST_RV_REF(avl_multiset) src, Cloner cloner, Disposer disposer)
1050 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
1051
1052 inline static avl_multiset &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
1053 { return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1054
1055 inline static const avl_multiset &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
1056 { return static_cast<const avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1057
1058 inline static avl_multiset &container_from_iterator(iterator it) BOOST_NOEXCEPT
1059 { return static_cast<avl_multiset &>(Base::container_from_iterator(it)); }
1060
1061 inline static const avl_multiset &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
1062 { return static_cast<const avl_multiset &>(Base::container_from_iterator(it)); }
1063 };
1064
1065 #endif
1066
1067 }
1068 }
1069
1070 #include <boost/intrusive/detail/config_end.hpp>
1071
1072 #endif