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