Warning, file /include/boost/intrusive/sg_set.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_INTRUSIVE_SG_SET_HPP
0013 #define BOOST_INTRUSIVE_SG_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/sgtree.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 sg_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 FloatingPoint, typename HeaderHolder>
0048 #endif
0049 class sg_set_impl
0050 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0051 : public sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder>
0052 #endif
0053 {
0054
0055 typedef sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
0056 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_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 sg_set_impl()
0090 : tree_type()
0091 {}
0092
0093
0094 explicit sg_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 sg_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 sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
0108 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0109 {}
0110
0111
0112 sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
0113 { return static_cast<sg_set_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0114
0115 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0116
0117 ~sg_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 sg_set_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0166
0167
0168 static const sg_set_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0169
0170
0171 static sg_set_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0172
0173
0174 static const sg_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(sg_set_impl& other);
0190
0191
0192 template <class Cloner, class Disposer>
0193 void clone_from(const sg_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(sg_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 &key);
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 void rebalance() BOOST_NOEXCEPT;
0416
0417
0418 iterator rebalance_subtree(iterator root) BOOST_NOEXCEPT;
0419
0420
0421 float balance_factor() const BOOST_NOEXCEPT;
0422
0423
0424 void balance_factor(float new_alpha) BOOST_NOEXCEPT;
0425
0426
0427 template<class ...Options2>
0428 void merge(sg_set<T, Options2...> &source);
0429
0430
0431 template<class ...Options2>
0432 void merge(sg_multiset<T, Options2...> &source);
0433
0434 #else
0435
0436 template<class Compare2>
0437 void merge(sg_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, FloatingPoint, HeaderHolder> &source)
0438 { return tree_type::merge_unique(source); }
0439
0440 template<class Compare2>
0441 void merge(sg_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, FloatingPoint, HeaderHolder> &source)
0442 { return tree_type::merge_unique(source); }
0443
0444 #endif
0445 };
0446
0447 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0448
0449 template<class T, class ...Options>
0450 bool operator!= (const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
0451
0452 template<class T, class ...Options>
0453 bool operator>(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
0454
0455 template<class T, class ...Options>
0456 bool operator<=(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
0457
0458 template<class T, class ...Options>
0459 bool operator>=(const sg_set_impl<T, Options...> &x, const sg_set_impl<T, Options...> &y);
0460
0461 template<class T, class ...Options>
0462 void swap(sg_set_impl<T, Options...> &x, sg_set_impl<T, Options...> &y);
0463
0464 #endif
0465
0466
0467
0468 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0469 template<class T, class ...Options>
0470 #else
0471 template<class T, class O1 = void, class O2 = void
0472 , class O3 = void, class O4 = void
0473 , class O5 = void, class O6 = void>
0474 #endif
0475 struct make_sg_set
0476 {
0477
0478 typedef typename pack_options
0479 < sgtree_defaults,
0480 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0481 O1, O2, O3, O4, O5, O6
0482 #else
0483 Options...
0484 #endif
0485 >::type packed_options;
0486
0487 typedef typename detail::get_value_traits
0488 <T, typename packed_options::proto_value_traits>::type value_traits;
0489
0490 typedef sg_set_impl
0491 < value_traits
0492 , typename packed_options::key_of_value
0493 , typename packed_options::compare
0494 , typename packed_options::size_type
0495 , packed_options::floating_point
0496 , typename packed_options::header_holder_type
0497 > implementation_defined;
0498
0499 typedef implementation_defined type;
0500 };
0501
0502 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0503 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0504 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
0505 #else
0506 template<class T, class ...Options>
0507 #endif
0508 class sg_set
0509 : public make_sg_set<T,
0510 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0511 O1, O2, O3, O4, O5, O6
0512 #else
0513 Options...
0514 #endif
0515 >::type
0516 {
0517 typedef typename make_sg_set
0518 <T,
0519 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0520 O1, O2, O3, O4, O5, O6
0521 #else
0522 Options...
0523 #endif
0524 >::type Base;
0525
0526 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set)
0527 public:
0528 typedef typename Base::key_compare key_compare;
0529 typedef typename Base::value_traits value_traits;
0530 typedef typename Base::iterator iterator;
0531 typedef typename Base::const_iterator const_iterator;
0532
0533
0534 BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
0535
0536 inline sg_set()
0537 : Base()
0538 {}
0539
0540 inline explicit sg_set( const key_compare &cmp, const value_traits &v_traits = value_traits())
0541 : Base(cmp, v_traits)
0542 {}
0543
0544 template<class Iterator>
0545 inline sg_set( Iterator b, Iterator e
0546 , const key_compare &cmp = key_compare()
0547 , const value_traits &v_traits = value_traits())
0548 : Base(b, e, cmp, v_traits)
0549 {}
0550
0551 inline sg_set(BOOST_RV_REF(sg_set) x)
0552 : Base(BOOST_MOVE_BASE(Base, x))
0553 {}
0554
0555 inline sg_set& operator=(BOOST_RV_REF(sg_set) x)
0556 { return static_cast<sg_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
0557
0558 template <class Cloner, class Disposer>
0559 inline void clone_from(const sg_set &src, Cloner cloner, Disposer disposer)
0560 { Base::clone_from(src, cloner, disposer); }
0561
0562 template <class Cloner, class Disposer>
0563 inline void clone_from(BOOST_RV_REF(sg_set) src, Cloner cloner, Disposer disposer)
0564 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
0565
0566 inline static sg_set &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
0567 { return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); }
0568
0569 inline static const sg_set &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
0570 { return static_cast<const sg_set &>(Base::container_from_end_iterator(end_iterator)); }
0571
0572 inline static sg_set &container_from_iterator(iterator it) BOOST_NOEXCEPT
0573 { return static_cast<sg_set &>(Base::container_from_iterator(it)); }
0574
0575 inline static const sg_set &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
0576 { return static_cast<const sg_set &>(Base::container_from_iterator(it)); }
0577 };
0578
0579 #endif
0580
0581
0582
0583
0584
0585
0586
0587
0588
0589
0590
0591
0592 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0593 template<class T, class ...Options>
0594 #else
0595 template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool FloatingPoint, typename HeaderHolder>
0596 #endif
0597 class sg_multiset_impl
0598 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0599 : public sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder>
0600 #endif
0601 {
0602
0603 typedef sgtree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, FloatingPoint, HeaderHolder> tree_type;
0604
0605 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset_impl)
0606 typedef tree_type implementation_defined;
0607
0608
0609 public:
0610 typedef typename implementation_defined::value_type value_type;
0611 typedef typename implementation_defined::key_type key_type;
0612 typedef typename implementation_defined::key_of_value key_of_value;
0613 typedef typename implementation_defined::value_traits value_traits;
0614 typedef typename implementation_defined::pointer pointer;
0615 typedef typename implementation_defined::const_pointer const_pointer;
0616 typedef typename implementation_defined::reference reference;
0617 typedef typename implementation_defined::const_reference const_reference;
0618 typedef typename implementation_defined::difference_type difference_type;
0619 typedef typename implementation_defined::size_type size_type;
0620 typedef typename implementation_defined::value_compare value_compare;
0621 typedef typename implementation_defined::key_compare key_compare;
0622 typedef typename implementation_defined::iterator iterator;
0623 typedef typename implementation_defined::const_iterator const_iterator;
0624 typedef typename implementation_defined::reverse_iterator reverse_iterator;
0625 typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
0626 typedef typename implementation_defined::insert_commit_data insert_commit_data;
0627 typedef typename implementation_defined::node_traits node_traits;
0628 typedef typename implementation_defined::node node;
0629 typedef typename implementation_defined::node_ptr node_ptr;
0630 typedef typename implementation_defined::const_node_ptr const_node_ptr;
0631 typedef typename implementation_defined::node_algorithms node_algorithms;
0632
0633 static const bool constant_time_size = tree_type::constant_time_size;
0634
0635 public:
0636
0637 sg_multiset_impl()
0638 : tree_type()
0639 {}
0640
0641
0642 explicit sg_multiset_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
0643 : tree_type(cmp, v_traits)
0644 {}
0645
0646
0647 template<class Iterator>
0648 sg_multiset_impl( Iterator b, Iterator e
0649 , const key_compare &cmp = key_compare()
0650 , const value_traits &v_traits = value_traits())
0651 : tree_type(false, b, e, cmp, v_traits)
0652 {}
0653
0654
0655 sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
0656 : tree_type(BOOST_MOVE_BASE(tree_type, x))
0657 {}
0658
0659
0660 sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
0661 { return static_cast<sg_multiset_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0662
0663 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0664
0665 ~sg_multiset_impl();
0666
0667
0668 iterator begin() BOOST_NOEXCEPT;
0669
0670
0671 const_iterator begin() const BOOST_NOEXCEPT;
0672
0673
0674 const_iterator cbegin() const BOOST_NOEXCEPT;
0675
0676
0677 iterator end() BOOST_NOEXCEPT;
0678
0679
0680 const_iterator end() const BOOST_NOEXCEPT;
0681
0682
0683 const_iterator cend() const BOOST_NOEXCEPT;
0684
0685
0686 reverse_iterator rbegin() BOOST_NOEXCEPT;
0687
0688
0689 const_reverse_iterator rbegin() const BOOST_NOEXCEPT;
0690
0691
0692 const_reverse_iterator crbegin() const BOOST_NOEXCEPT;
0693
0694
0695 reverse_iterator rend() BOOST_NOEXCEPT;
0696
0697
0698 const_reverse_iterator rend() const BOOST_NOEXCEPT;
0699
0700
0701 const_reverse_iterator crend() const BOOST_NOEXCEPT;
0702
0703
0704 iterator root() BOOST_NOEXCEPT;
0705
0706
0707 const_iterator root() const BOOST_NOEXCEPT;
0708
0709
0710 const_iterator croot() const BOOST_NOEXCEPT;
0711
0712
0713 static sg_multiset_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0714
0715
0716 static const sg_multiset_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0717
0718
0719 static sg_multiset_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0720
0721
0722 static const sg_multiset_impl &container_from_iterator(const_iterator it) BOOST_NOEXCEPT;
0723
0724
0725 key_compare key_comp() const;
0726
0727
0728 value_compare value_comp() const;
0729
0730
0731 bool empty() const BOOST_NOEXCEPT;
0732
0733
0734 size_type size() const BOOST_NOEXCEPT;
0735
0736
0737 void swap(sg_multiset_impl& other);
0738
0739
0740 template <class Cloner, class Disposer>
0741 void clone_from(const sg_multiset_impl &src, Cloner cloner, Disposer disposer);
0742
0743 #else
0744
0745 using tree_type::clone_from;
0746
0747 #endif
0748
0749
0750 template <class Cloner, class Disposer>
0751 void clone_from(BOOST_RV_REF(sg_multiset_impl) src, Cloner cloner, Disposer disposer)
0752 { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
0753
0754
0755 iterator insert(reference value)
0756 { return tree_type::insert_equal(value); }
0757
0758
0759 iterator insert(const_iterator hint, reference value)
0760 { return tree_type::insert_equal(hint, value); }
0761
0762
0763 template<class Iterator>
0764 void insert(Iterator b, Iterator e)
0765 { tree_type::insert_equal(b, e); }
0766
0767 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0768
0769 iterator insert_before(const_iterator pos, reference value) BOOST_NOEXCEPT;
0770
0771
0772 void push_back(reference value) BOOST_NOEXCEPT;
0773
0774
0775 void push_front(reference value) BOOST_NOEXCEPT;
0776
0777
0778 iterator erase(const_iterator i) BOOST_NOEXCEPT;
0779
0780
0781 iterator erase(const_iterator b, const_iterator e) BOOST_NOEXCEPT;
0782
0783
0784 size_type erase(const key_type &key);
0785
0786
0787 template<class KeyType, class KeyTypeKeyCompare>
0788 size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
0789
0790
0791 template<class Disposer>
0792 iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT;
0793
0794
0795 template<class Disposer>
0796 iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) BOOST_NOEXCEPT;
0797
0798
0799 template<class Disposer>
0800 size_type erase_and_dispose(const key_type &key, Disposer disposer);
0801
0802
0803 template<class KeyType, class KeyTypeKeyCompare, class Disposer>
0804 size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
0805
0806
0807 void clear() BOOST_NOEXCEPT;
0808
0809
0810 template<class Disposer>
0811 void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT;
0812
0813
0814 size_type count(const key_type &key) const;
0815
0816
0817 template<class KeyType, class KeyTypeKeyCompare>
0818 size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
0819
0820
0821 iterator lower_bound(const key_type &key);
0822
0823
0824 template<class KeyType, class KeyTypeKeyCompare>
0825 iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
0826
0827
0828 const_iterator lower_bound(const key_type &key) const;
0829
0830
0831 template<class KeyType, class KeyTypeKeyCompare>
0832 const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0833
0834
0835 iterator upper_bound(const key_type &key);
0836
0837
0838 template<class KeyType, class KeyTypeKeyCompare>
0839 iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
0840
0841
0842 const_iterator upper_bound(const key_type &key) const;
0843
0844
0845 template<class KeyType, class KeyTypeKeyCompare>
0846 const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
0847
0848
0849 iterator find(const key_type &key);
0850
0851
0852 template<class KeyType, class KeyTypeKeyCompare>
0853 iterator find(const KeyType& key, KeyTypeKeyCompare comp);
0854
0855
0856 const_iterator find(const key_type &key) const;
0857
0858
0859 template<class KeyType, class KeyTypeKeyCompare>
0860 const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
0861
0862
0863 std::pair<iterator,iterator> equal_range(const key_type &key);
0864
0865
0866 template<class KeyType, class KeyTypeKeyCompare>
0867 std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
0868
0869
0870 std::pair<const_iterator, const_iterator>
0871 equal_range(const key_type &key) const;
0872
0873
0874 template<class KeyType, class KeyTypeKeyCompare>
0875 std::pair<const_iterator, const_iterator>
0876 equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
0877
0878
0879 std::pair<iterator,iterator> bounded_range
0880 (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
0881
0882
0883 template<class KeyType, class KeyTypeKeyCompare>
0884 std::pair<iterator,iterator> bounded_range
0885 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
0886
0887
0888 std::pair<const_iterator, const_iterator>
0889 bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
0890
0891
0892 template<class KeyType, class KeyTypeKeyCompare>
0893 std::pair<const_iterator, const_iterator> bounded_range
0894 (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
0895
0896
0897 static iterator s_iterator_to(reference value) BOOST_NOEXCEPT;
0898
0899
0900 static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT;
0901
0902
0903 iterator iterator_to(reference value) BOOST_NOEXCEPT;
0904
0905
0906 const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT;
0907
0908
0909 static void init_node(reference value) BOOST_NOEXCEPT;
0910
0911
0912 pointer unlink_leftmost_without_rebalance() BOOST_NOEXCEPT;
0913
0914
0915 void replace_node(iterator replace_this, reference with_this) BOOST_NOEXCEPT;
0916
0917
0918 void remove_node(reference value) BOOST_NOEXCEPT;
0919
0920
0921 void rebalance() BOOST_NOEXCEPT;
0922
0923
0924 iterator rebalance_subtree(iterator root) BOOST_NOEXCEPT;
0925
0926
0927 float balance_factor() const BOOST_NOEXCEPT;
0928
0929
0930 void balance_factor(float new_alpha) BOOST_NOEXCEPT;
0931
0932
0933 template<class ...Options2>
0934 void merge(sg_multiset<T, Options2...> &source);
0935
0936
0937 template<class ...Options2>
0938 void merge(sg_set<T, Options2...> &source);
0939
0940 #else
0941
0942 template<class Compare2>
0943 void merge(sg_multiset_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, FloatingPoint, HeaderHolder> &source)
0944 { return tree_type::merge_equal(source); }
0945
0946 template<class Compare2>
0947 void merge(sg_set_impl<ValueTraits, VoidOrKeyOfValue, Compare2, SizeType, FloatingPoint, HeaderHolder> &source)
0948 { return tree_type::merge_equal(source); }
0949
0950 #endif
0951 };
0952
0953 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0954
0955 template<class T, class ...Options>
0956 bool operator!= (const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
0957
0958 template<class T, class ...Options>
0959 bool operator>(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
0960
0961 template<class T, class ...Options>
0962 bool operator<=(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
0963
0964 template<class T, class ...Options>
0965 bool operator>=(const sg_multiset_impl<T, Options...> &x, const sg_multiset_impl<T, Options...> &y);
0966
0967 template<class T, class ...Options>
0968 void swap(sg_multiset_impl<T, Options...> &x, sg_multiset_impl<T, Options...> &y);
0969
0970 #endif
0971
0972
0973
0974 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0975 template<class T, class ...Options>
0976 #else
0977 template<class T, class O1 = void, class O2 = void
0978 , class O3 = void, class O4 = void
0979 , class O5 = void, class O6 = void>
0980 #endif
0981 struct make_sg_multiset
0982 {
0983
0984 typedef typename pack_options
0985 < sgtree_defaults,
0986 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0987 O1, O2, O3, O4, O5, O6
0988 #else
0989 Options...
0990 #endif
0991 >::type packed_options;
0992
0993 typedef typename detail::get_value_traits
0994 <T, typename packed_options::proto_value_traits>::type value_traits;
0995
0996 typedef sg_multiset_impl
0997 < value_traits
0998 , typename packed_options::key_of_value
0999 , typename packed_options::compare
1000 , typename packed_options::size_type
1001 , packed_options::floating_point
1002 , typename packed_options::header_holder_type
1003 > implementation_defined;
1004
1005 typedef implementation_defined type;
1006 };
1007
1008 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
1009
1010 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
1011 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
1012 #else
1013 template<class T, class ...Options>
1014 #endif
1015 class sg_multiset
1016 : public make_sg_multiset<T,
1017 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
1018 O1, O2, O3, O4, O5, O6
1019 #else
1020 Options...
1021 #endif
1022 >::type
1023 {
1024 typedef typename make_sg_multiset<T,
1025 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
1026 O1, O2, O3, O4, O5, O6
1027 #else
1028 Options...
1029 #endif
1030 >::type Base;
1031
1032 BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset)
1033
1034 public:
1035 typedef typename Base::key_compare key_compare;
1036 typedef typename Base::value_traits value_traits;
1037 typedef typename Base::iterator iterator;
1038 typedef typename Base::const_iterator const_iterator;
1039
1040
1041 BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
1042
1043 inline sg_multiset()
1044 : Base()
1045 {}
1046
1047 inline explicit sg_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits())
1048 : Base(cmp, v_traits)
1049 {}
1050
1051 template<class Iterator>
1052 inline sg_multiset( Iterator b, Iterator e
1053 , const key_compare &cmp = key_compare()
1054 , const value_traits &v_traits = value_traits())
1055 : Base(b, e, cmp, v_traits)
1056 {}
1057
1058 inline sg_multiset(BOOST_RV_REF(sg_multiset) x)
1059 : Base(BOOST_MOVE_BASE(Base, x))
1060 {}
1061
1062 inline sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x)
1063 { return static_cast<sg_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
1064
1065 template <class Cloner, class Disposer>
1066 inline void clone_from(const sg_multiset &src, Cloner cloner, Disposer disposer)
1067 { Base::clone_from(src, cloner, disposer); }
1068
1069 template <class Cloner, class Disposer>
1070 inline void clone_from(BOOST_RV_REF(sg_multiset) src, Cloner cloner, Disposer disposer)
1071 { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
1072
1073 inline static sg_multiset &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
1074 { return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1075
1076 inline static const sg_multiset &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
1077 { return static_cast<const sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
1078
1079 inline static sg_multiset &container_from_iterator(iterator it) BOOST_NOEXCEPT
1080 { return static_cast<sg_multiset &>(Base::container_from_iterator(it)); }
1081
1082 inline static const sg_multiset &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
1083 { return static_cast<const sg_multiset &>(Base::container_from_iterator(it)); }
1084 };
1085
1086 #endif
1087
1088 }
1089 }
1090
1091 #include <boost/intrusive/detail/config_end.hpp>
1092
1093 #endif