File indexing completed on 2025-09-18 08:47:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_INTRUSIVE_BS_SET_HPP
0013 #define BOOST_INTRUSIVE_BS_SET_HPP
0014
0015 #include <boost/intrusive/detail/config_begin.hpp>
0016 #include <boost/intrusive/intrusive_fwd.hpp>
0017 #include <boost/intrusive/detail/mpl.hpp>
0018 #include <boost/intrusive/bstree.hpp>
0019 #include <boost/move/utility_core.hpp>
0020
0021 #if defined(BOOST_HAS_PRAGMA_ONCE)
0022 # pragma once
0023 #endif
0024
0025 #if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0026 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0027 class bs_multiset_impl;
0028 #endif
0029
0030 namespace boost {
0031 namespace intrusive {
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 bs_set_impl
0050 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0051 : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
0052 #endif
0053 {
0054
0055 typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> tree_type;
0056 BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_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::value_traits value_traits;
0065 typedef typename implementation_defined::pointer pointer;
0066 typedef typename implementation_defined::const_pointer const_pointer;
0067 typedef typename implementation_defined::reference reference;
0068 typedef typename implementation_defined::const_reference const_reference;
0069 typedef typename implementation_defined::difference_type difference_type;
0070 typedef typename implementation_defined::size_type size_type;
0071 typedef typename implementation_defined::value_compare value_compare;
0072 typedef typename implementation_defined::key_compare key_compare;
0073 typedef typename implementation_defined::iterator iterator;
0074 typedef typename implementation_defined::const_iterator const_iterator;
0075 typedef typename implementation_defined::reverse_iterator reverse_iterator;
0076 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
0077 typedef typename implementation_defined::insert_commit_data insert_commit_data;
0078 typedef typename implementation_defined::node_traits node_traits;
0079 typedef typename implementation_defined::node node;
0080 typedef typename implementation_defined::node_ptr node_ptr;
0081 typedef typename implementation_defined::const_node_ptr const_node_ptr;
0082 typedef typename implementation_defined::node_algorithms node_algorithms;
0083
0084 static const bool constant_time_size = tree_type::constant_time_size;
0085
0086 public:
0087
0088 bs_set_impl()
0089 : tree_type()
0090 {}
0091
0092
0093 explicit bs_set_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
0094 : tree_type(cmp, v_traits)
0095 {}
0096
0097
0098 template<class Iterator>
0099 bs_set_impl( Iterator b, Iterator e
0100 , const key_compare &cmp = key_compare()
0101 , const value_traits &v_traits = value_traits())
0102 : tree_type(true, b, e, cmp, v_traits)
0103 {}
0104
0105
0106 bs_set_impl(BOOST_RV_REF(bs_set_impl) x)
0107 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0108 {}
0109
0110
0111 bs_set_impl& operator=(BOOST_RV_REF(bs_set_impl) x)
0112 { return static_cast<bs_set_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0113
0114 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0115
0116 ~bs_set_impl();
0117
0118
0119 iterator begin() BOOST_NOEXCEPT;
0120
0121
0122 const_iterator begin() const BOOST_NOEXCEPT;
0123
0124
0125 const_iterator cbegin() const BOOST_NOEXCEPT;
0126
0127
0128 iterator end() BOOST_NOEXCEPT;
0129
0130
0131 const_iterator end() const BOOST_NOEXCEPT;
0132
0133
0134 const_iterator cend() const BOOST_NOEXCEPT;
0135
0136
0137 reverse_iterator rbegin() BOOST_NOEXCEPT;
0138
0139
0140 const_reverse_iterator rbegin() const BOOST_NOEXCEPT;
0141
0142
0143 const_reverse_iterator crbegin() const BOOST_NOEXCEPT;
0144
0145
0146 reverse_iterator rend() BOOST_NOEXCEPT;
0147
0148
0149 const_reverse_iterator rend() const BOOST_NOEXCEPT;
0150
0151
0152 const_reverse_iterator crend() const BOOST_NOEXCEPT;
0153
0154
0155 iterator root() BOOST_NOEXCEPT;
0156
0157
0158 const_iterator root() const BOOST_NOEXCEPT;
0159
0160
0161 const_iterator croot() const BOOST_NOEXCEPT;
0162
0163
0164 static bs_set_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0165
0166
0167 static const bs_set_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0168
0169
0170 static bs_set_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0171
0172
0173 static const bs_set_impl &container_from_iterator(const_iterator it) BOOST_NOEXCEPT;
0174
0175
0176 key_compare key_comp() const;
0177
0178
0179 value_compare value_comp() const;
0180
0181
0182 bool empty() const BOOST_NOEXCEPT;
0183
0184
0185 size_type size() const BOOST_NOEXCEPT;
0186
0187
0188 void swap(bs_set_impl& other);
0189
0190
0191 template <class Cloner, class Disposer>
0192 void clone_from(const bs_set_impl &src, Cloner cloner, Disposer disposer);
0193
0194 #else
0195
0196 using tree_type::clone_from;
0197
0198 #endif
0199
0200
0201 template <class Cloner, class Disposer>
0202 void clone_from(BOOST_RV_REF(bs_set_impl) src, Cloner cloner, Disposer disposer)
0203 { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
0204
0205
0206 std::pair<iterator, bool> insert(reference value)
0207 { return tree_type::insert_unique(value); }
0208
0209
0210 iterator insert(const_iterator hint, reference value)
0211 { return tree_type::insert_unique(hint, value); }
0212
0213
0214 std::pair<iterator, bool> insert_check
0215 (const key_type &key, insert_commit_data &commit_data)
0216 { return tree_type::insert_unique_check(key, commit_data); }
0217
0218
0219 std::pair<iterator, bool> insert_check
0220 (const_iterator hint, const key_type &key
0221 ,insert_commit_data &commit_data)
0222 { return tree_type::insert_unique_check(hint, key, commit_data); }
0223
0224
0225 template<class KeyType, class KeyTypeKeyCompare>
0226 std::pair<iterator, bool> insert_check
0227 (const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
0228 { return tree_type::insert_unique_check(key, comp, commit_data); }
0229
0230
0231 template<class KeyType, class KeyTypeKeyCompare>
0232 std::pair<iterator, bool> insert_check
0233 (const_iterator hint, const KeyType &key
0234 ,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
0235 { return tree_type::insert_unique_check(hint, key, comp, commit_data); }
0236
0237
0238 template<class Iterator>
0239 void insert(Iterator b, Iterator e)
0240 { tree_type::insert_unique(b, e); }
0241
0242
0243 iterator insert_commit(reference value, const insert_commit_data &commit_data) BOOST_NOEXCEPT
0244 { return tree_type::insert_unique_commit(value, commit_data); }
0245
0246 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0247
0248 iterator insert_before(const_iterator pos, reference value) BOOST_NOEXCEPT;
0249
0250
0251 void push_back(reference value) BOOST_NOEXCEPT;
0252
0253
0254 void push_front(reference value) BOOST_NOEXCEPT;
0255
0256
0257 iterator erase(const_iterator i) BOOST_NOEXCEPT;
0258
0259
0260 iterator erase(const_iterator b, const_iterator e) BOOST_NOEXCEPT;
0261
0262
0263 size_type erase(const key_type &key);
0264
0265
0266 template<class KeyType, class KeyTypeKeyCompare>
0267 size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
0268
0269
0270 template<class Disposer>
0271 iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT;
0272
0273
0274 template<class Disposer>
0275 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) BOOST_NOEXCEPT;
0276
0277
0278 template<class Disposer>
0279 size_type erase_and_dispose(const key_type &key, Disposer disposer);
0280
0281
0282 template<class KeyType, class KeyTypeKeyCompare, class Disposer>
0283 size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
0284
0285
0286 void clear() BOOST_NOEXCEPT;
0287
0288
0289 template<class Disposer>
0290 void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT;
0291
0292 #endif
0293
0294
0295 size_type count(const key_type &key) const
0296 { return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
0297
0298
0299 template<class KeyType, class KeyTypeKeyCompare>
0300 size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
0301 { return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
0302
0303 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0304
0305
0306 iterator lower_bound(const key_type &);
0307
0308
0309 template<class KeyType, class KeyTypeKeyCompare>
0310 iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
0311
0312
0313 const_iterator lower_bound(const key_type &key) const;
0314
0315
0316 template<class KeyType, class KeyTypeKeyCompare>
0317 const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0318
0319
0320 iterator upper_bound(const key_type &key);
0321
0322
0323 template<class KeyType, class KeyTypeKeyCompare>
0324 iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
0325
0326
0327 const_iterator upper_bound(const key_type &key) const;
0328
0329
0330 template<class KeyType, class KeyTypeKeyCompare>
0331 const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0332
0333
0334 iterator find(const key_type &key);
0335
0336
0337 template<class KeyType, class KeyTypeKeyCompare>
0338 iterator find(const KeyType& key, KeyTypeKeyCompare comp);
0339
0340
0341 const_iterator find(const key_type &key) const;
0342
0343
0344 template<class KeyType, class KeyTypeKeyCompare>
0345 const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
0346
0347 #endif
0348
0349
0350 std::pair<iterator,iterator> equal_range(const key_type &key)
0351 { return this->tree_type::lower_bound_range(key); }
0352
0353
0354 template<class KeyType, class KeyTypeKeyCompare>
0355 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
0356 { return this->tree_type::equal_range(key, comp); }
0357
0358
0359 std::pair<const_iterator, const_iterator>
0360 equal_range(const key_type &key) const
0361 { return this->tree_type::lower_bound_range(key); }
0362
0363
0364 template<class KeyType, class KeyTypeKeyCompare>
0365 std::pair<const_iterator, const_iterator>
0366 equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
0367 { return this->tree_type::equal_range(key, comp); }
0368
0369 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0370
0371
0372 std::pair<iterator,iterator> bounded_range
0373 (const key_type& lower_key, const key_type& upper_key, bool left_closed, bool right_closed);
0374
0375
0376 template<class KeyType, class KeyTypeKeyCompare>
0377 std::pair<iterator,iterator> bounded_range
0378 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
0379
0380
0381 std::pair<const_iterator, const_iterator>
0382 bounded_range(const key_type& lower_key, const key_type& upper_key, bool left_closed, bool right_closed) const;
0383
0384
0385 template<class KeyType, class KeyTypeKeyCompare>
0386 std::pair<const_iterator, const_iterator> bounded_range
0387 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
0388
0389
0390 static iterator s_iterator_to(reference value) BOOST_NOEXCEPT;
0391
0392
0393 static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT;
0394
0395
0396 iterator iterator_to(reference value) BOOST_NOEXCEPT;
0397
0398
0399 const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT;
0400
0401
0402 static void init_node(reference value) BOOST_NOEXCEPT;
0403
0404
0405 pointer unlink_leftmost_without_rebalance() BOOST_NOEXCEPT;
0406
0407
0408 void replace_node(iterator replace_this, reference with_this) BOOST_NOEXCEPT;
0409
0410
0411 void remove_node(reference value) BOOST_NOEXCEPT;
0412
0413
0414 template<class ...Options2>
0415 void merge(bs_set<T, Options2...> &source);
0416
0417
0418 template<class ...Options2>
0419 void merge(bs_multiset<T, Options2...> &source);
0420
0421 #else
0422
0423 template<class Compare2>
0424 void merge(bs_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0425 { return tree_type::merge_unique(source); }
0426
0427
0428 template<class Compare2>
0429 void merge(bs_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0430 { return tree_type::merge_unique(source); }
0431
0432 #endif
0433 };
0434
0435 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0436
0437 template<class T, class ...Options>
0438 bool operator!= (const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
0439
0440 template<class T, class ...Options>
0441 bool operator>(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
0442
0443 template<class T, class ...Options>
0444 bool operator<=(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
0445
0446 template<class T, class ...Options>
0447 bool operator>=(const bs_set_impl<T, Options...> &x, const bs_set_impl<T, Options...> &y);
0448
0449 template<class T, class ...Options>
0450 void swap(bs_set_impl<T, Options...> &x, bs_set_impl<T, Options...> &y);
0451
0452 #endif
0453
0454
0455
0456 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0457 template<class T, class ...Options>
0458 #else
0459 template<class T, class O1 = void, class O2 = void
0460 , class O3 = void, class O4 = void
0461 , class O5 = void, class O6 = void>
0462 #endif
0463 struct make_bs_set
0464 {
0465
0466 typedef typename pack_options
0467 < bstree_defaults,
0468 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0469 O1, O2, O3, O4, O5, O6
0470 #else
0471 Options...
0472 #endif
0473 >::type packed_options;
0474
0475 typedef typename detail::get_value_traits
0476 <T, typename packed_options::proto_value_traits>::type value_traits;
0477
0478 typedef bs_set_impl
0479 < value_traits
0480 , typename packed_options::key_of_value
0481 , typename packed_options::compare
0482 , typename packed_options::size_type
0483 , packed_options::constant_time_size
0484 , typename packed_options::header_holder_type
0485 > implementation_defined;
0486
0487 typedef implementation_defined type;
0488 };
0489
0490 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0491 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0492 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
0493 #else
0494 template<class T, class ...Options>
0495 #endif
0496 class bs_set
0497 : public make_bs_set<T,
0498 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0499 O1, O2, O3, O4, O5, O6
0500 #else
0501 Options...
0502 #endif
0503 >::type
0504 {
0505 typedef typename make_bs_set
0506 <T,
0507 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0508 O1, O2, O3, O4, O5, O6
0509 #else
0510 Options...
0511 #endif
0512 >::type Base;
0513
0514 BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_set)
0515 public:
0516 typedef typename Base::value_traits value_traits;
0517 typedef typename Base::key_compare key_compare;
0518 typedef typename Base::iterator iterator;
0519 typedef typename Base::const_iterator const_iterator;
0520
0521
0522 BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
0523
0524 inline bs_set()
0525 : Base()
0526 {}
0527
0528 inline explicit bs_set( const key_compare &cmp, const value_traits &v_traits = value_traits())
0529 : Base(cmp, v_traits)
0530 {}
0531
0532 template<class Iterator>
0533 inline bs_set( Iterator b, Iterator e
0534 , const key_compare &cmp = key_compare()
0535 , const value_traits &v_traits = value_traits())
0536 : Base(b, e, cmp, v_traits)
0537 {}
0538
0539 inline bs_set(BOOST_RV_REF(bs_set) x)
0540 : Base(BOOST_MOVE_BASE(Base, x))
0541 {}
0542
0543 inline bs_set& operator=(BOOST_RV_REF(bs_set) x)
0544 { return static_cast<bs_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
0545
0546 template <class Cloner, class Disposer>
0547 inline void clone_from(const bs_set &src, Cloner cloner, Disposer disposer)
0548 { Base::clone_from(src, cloner, disposer); }
0549
0550 template <class Cloner, class Disposer>
0551 inline void clone_from(BOOST_RV_REF(bs_set) src, Cloner cloner, Disposer disposer)
0552 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
0553
0554 BOOST_INTRUSIVE_NO_DANGLING
0555 inline static bs_set &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
0556 { return static_cast<bs_set &>(Base::container_from_end_iterator(end_iterator)); }
0557
0558 BOOST_INTRUSIVE_NO_DANGLING
0559 inline static const bs_set &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
0560 { return static_cast<const bs_set &>(Base::container_from_end_iterator(end_iterator)); }
0561
0562 BOOST_INTRUSIVE_NO_DANGLING
0563 inline static bs_set &container_from_iterator(iterator it) BOOST_NOEXCEPT
0564 { return static_cast<bs_set &>(Base::container_from_iterator(it)); }
0565
0566 BOOST_INTRUSIVE_NO_DANGLING
0567 inline static const bs_set &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
0568 { return static_cast<const bs_set &>(Base::container_from_iterator(it)); }
0569 };
0570
0571 #endif
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0585 template<class T, class ...Options>
0586 #else
0587 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0588 #endif
0589 class bs_multiset_impl
0590 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0591 : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder>
0592 #endif
0593 {
0594
0595 typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, BsTreeAlgorithms, HeaderHolder> tree_type;
0596
0597 BOOST_MOVABLE_BUT_NOT_COPYABLE(bs_multiset_impl)
0598 typedef tree_type implementation_defined;
0599
0600
0601 public:
0602 typedef typename implementation_defined::value_type value_type;
0603 typedef typename implementation_defined::key_type key_type;
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 bs_multiset_impl()
0629 : tree_type()
0630 {}
0631
0632
0633 explicit bs_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 bs_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 bs_multiset_impl(BOOST_RV_REF(bs_multiset_impl) x)
0647 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0648 {}
0649
0650
0651 bs_multiset_impl& operator=(BOOST_RV_REF(bs_multiset_impl) x)
0652 { return static_cast<bs_multiset_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0653
0654 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0655
0656 ~bs_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 bs_multiset_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0705
0706
0707 static const bs_multiset_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0708
0709
0710 static bs_multiset_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0711
0712
0713 static const bs_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(bs_multiset_impl& other);
0729
0730
0731 template <class Cloner, class Disposer>
0732 void clone_from(const bs_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(bs_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 & 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(bs_multiset<T, Options2...> &source);
0914
0915
0916 template<class ...Options2>
0917 void merge(bs_set<T, Options2...> &source);
0918
0919 #else
0920
0921 template<class Compare2>
0922 void merge(bs_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, ConstantTimeSize, HeaderHolder> &source)
0923 { return tree_type::merge_equal(source); }
0924
0925 template<class Compare2>
0926 void merge(bs_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 bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
0936
0937 template<class T, class ...Options>
0938 bool operator>(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
0939
0940 template<class T, class ...Options>
0941 bool operator<=(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
0942
0943 template<class T, class ...Options>
0944 bool operator>=(const bs_multiset_impl<T, Options...> &x, const bs_multiset_impl<T, Options...> &y);
0945
0946 template<class T, class ...Options>
0947 void swap(bs_multiset_impl<T, Options...> &x, bs_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_bs_multiset
0961 {
0962
0963 typedef typename pack_options
0964 < bstree_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 bs_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 bs_multiset
0995 : public make_bs_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_bs_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(bs_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 bs_multiset()
1023 : Base()
1024 {}
1025
1026 inline explicit bs_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 bs_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 bs_multiset(BOOST_RV_REF(bs_multiset) x)
1038 : Base(BOOST_MOVE_BASE(Base, x))
1039 {}
1040
1041 inline bs_multiset& operator=(BOOST_RV_REF(bs_multiset) x)
1042 { return static_cast<bs_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
1043
1044 template <class Cloner, class Disposer>
1045 inline void clone_from(const bs_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(bs_multiset) src, Cloner cloner, Disposer disposer)
1050 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
1051
1052 BOOST_INTRUSIVE_NO_DANGLING
1053 inline static bs_multiset &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
1054 { return static_cast<bs_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1055
1056 BOOST_INTRUSIVE_NO_DANGLING
1057 inline static const bs_multiset &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
1058 { return static_cast<const bs_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1059
1060 BOOST_INTRUSIVE_NO_DANGLING
1061 inline static bs_multiset &container_from_iterator(iterator it) BOOST_NOEXCEPT
1062 { return static_cast<bs_multiset &>(Base::container_from_iterator(it)); }
1063
1064 BOOST_INTRUSIVE_NO_DANGLING
1065 inline static const bs_multiset &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
1066 { return static_cast<const bs_multiset &>(Base::container_from_iterator(it)); }
1067 };
1068
1069 #endif
1070
1071 }
1072 }
1073
1074 #include <boost/intrusive/detail/config_end.hpp>
1075
1076 #endif