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