Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:36:09

0001 /////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga  2007-2014
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // See http://www.boost.org/libs/intrusive for documentation.
0010 //
0011 /////////////////////////////////////////////////////////////////////////////
0012 #ifndef BOOST_INTRUSIVE_SPLAYTREE_HPP
0013 #define BOOST_INTRUSIVE_SPLAYTREE_HPP
0014 
0015 #include <boost/intrusive/detail/config_begin.hpp>
0016 #include <boost/intrusive/intrusive_fwd.hpp>
0017 #include <cstddef>
0018 #include <boost/intrusive/detail/minimal_less_equal_header.hpp>
0019 #include <boost/intrusive/detail/minimal_pair_header.hpp>   //std::pair
0020 
0021 #include <boost/intrusive/bstree.hpp>
0022 #include <boost/intrusive/detail/tree_node.hpp>
0023 #include <boost/intrusive/detail/mpl.hpp>
0024 #include <boost/intrusive/pointer_traits.hpp>
0025 #include <boost/intrusive/detail/function_detector.hpp>
0026 #include <boost/intrusive/detail/get_value_traits.hpp>
0027 #include <boost/intrusive/splaytree_algorithms.hpp>
0028 #include <boost/intrusive/link_mode.hpp>
0029 #include <boost/intrusive/detail/key_nodeptr_comp.hpp>
0030 #include <boost/move/utility_core.hpp>
0031 
0032 #if defined(BOOST_HAS_PRAGMA_ONCE)
0033 #  pragma once
0034 #endif
0035 
0036 namespace boost {
0037 namespace intrusive {
0038 
0039 /// @cond
0040 
0041 struct splaytree_defaults
0042    : bstree_defaults
0043 {};
0044 
0045 /// @endcond
0046 
0047 //! The class template splaytree is an intrusive splay tree container that
0048 //! is used to construct intrusive splay_set and splay_multiset containers. The no-throw
0049 //! guarantee holds only, if the key_compare object
0050 //! doesn't throw.
0051 //!
0052 //! The template parameter \c T is the type to be managed by the container.
0053 //! The user can specify additional options and if no options are provided
0054 //! default options are used.
0055 //!
0056 //! The container supports the following options:
0057 //! \c base_hook<>/member_hook<>/value_traits<>,
0058 //! \c constant_time_size<>, \c size_type<> and
0059 //! \c compare<>.
0060 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
0061 template<class T, class ...Options>
0062 #else
0063 template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
0064 #endif
0065 class splaytree_impl
0066    /// @cond
0067    :  public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, SplayTreeAlgorithms, HeaderHolder>
0068    /// @endcond
0069 {
0070    public:
0071    typedef ValueTraits                                               value_traits;
0072    /// @cond
0073    typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
0074                       , ConstantTimeSize, SplayTreeAlgorithms
0075                       , HeaderHolder>                                tree_type;
0076    typedef tree_type                                                 implementation_defined;
0077    /// @endcond
0078 
0079    typedef typename implementation_defined::pointer                  pointer;
0080    typedef typename implementation_defined::const_pointer            const_pointer;
0081    typedef typename implementation_defined::value_type               value_type;
0082    typedef typename implementation_defined::key_type                 key_type;
0083    typedef typename implementation_defined::key_of_value             key_of_value;
0084    typedef typename implementation_defined::reference                reference;
0085    typedef typename implementation_defined::const_reference          const_reference;
0086    typedef typename implementation_defined::difference_type          difference_type;
0087    typedef typename implementation_defined::size_type                size_type;
0088    typedef typename implementation_defined::value_compare            value_compare;
0089    typedef typename implementation_defined::key_compare              key_compare;
0090    typedef typename implementation_defined::iterator                 iterator;
0091    typedef typename implementation_defined::const_iterator           const_iterator;
0092    typedef typename implementation_defined::reverse_iterator         reverse_iterator;
0093    typedef typename implementation_defined::const_reverse_iterator   const_reverse_iterator;
0094    typedef typename implementation_defined::node_traits              node_traits;
0095    typedef typename implementation_defined::node                     node;
0096    typedef typename implementation_defined::node_ptr                 node_ptr;
0097    typedef typename implementation_defined::const_node_ptr           const_node_ptr;
0098    typedef typename implementation_defined::node_algorithms          node_algorithms;
0099 
0100    static const bool constant_time_size = implementation_defined::constant_time_size;
0101    /// @cond
0102    private:
0103 
0104    //noncopyable
0105    BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree_impl)
0106 
0107    /// @endcond
0108 
0109    public:
0110 
0111    typedef typename implementation_defined::insert_commit_data insert_commit_data;
0112 
0113    //! @copydoc ::boost::intrusive::bstree::bstree()
0114    splaytree_impl()
0115       :  tree_type()
0116    {}
0117 
0118    //! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
0119    explicit splaytree_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
0120       :  tree_type(cmp, v_traits)
0121    {}
0122 
0123    //! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
0124    template<class Iterator>
0125    splaytree_impl( bool unique, Iterator b, Iterator e
0126               , const key_compare &cmp     = key_compare()
0127               , const value_traits &v_traits = value_traits())
0128       : tree_type(cmp, v_traits)
0129    {
0130       if(unique)
0131          this->insert_unique(b, e);
0132       else
0133          this->insert_equal(b, e);
0134    }
0135 
0136    //! @copydoc ::boost::intrusive::bstree::bstree(bstree &&)
0137    splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
0138       :  tree_type(BOOST_MOVE_BASE(tree_type, x))
0139    {}
0140 
0141    //! @copydoc ::boost::intrusive::bstree::operator=(bstree &&)
0142    splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
0143    {  return static_cast<splaytree_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
0144 
0145    #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0146    //! @copydoc ::boost::intrusive::bstree::~bstree()
0147    ~splaytree_impl();
0148 
0149    //! @copydoc ::boost::intrusive::bstree::begin()
0150    iterator begin() BOOST_NOEXCEPT;
0151 
0152    //! @copydoc ::boost::intrusive::bstree::begin()const
0153    const_iterator begin() const BOOST_NOEXCEPT;
0154 
0155    //! @copydoc ::boost::intrusive::bstree::cbegin()const
0156    const_iterator cbegin() const BOOST_NOEXCEPT;
0157 
0158    //! @copydoc ::boost::intrusive::bstree::end()
0159    iterator end() BOOST_NOEXCEPT;
0160 
0161    //! @copydoc ::boost::intrusive::bstree::end()const
0162    const_iterator end() const BOOST_NOEXCEPT;
0163 
0164    //! @copydoc ::boost::intrusive::bstree::cend()const
0165    const_iterator cend() const BOOST_NOEXCEPT;
0166 
0167    //! @copydoc ::boost::intrusive::bstree::rbegin()
0168    reverse_iterator rbegin() BOOST_NOEXCEPT;
0169 
0170    //! @copydoc ::boost::intrusive::bstree::rbegin()const
0171    const_reverse_iterator rbegin() const BOOST_NOEXCEPT;
0172 
0173    //! @copydoc ::boost::intrusive::bstree::crbegin()const
0174    const_reverse_iterator crbegin() const BOOST_NOEXCEPT;
0175 
0176    //! @copydoc ::boost::intrusive::bstree::rend()
0177    reverse_iterator rend() BOOST_NOEXCEPT;
0178 
0179    //! @copydoc ::boost::intrusive::bstree::rend()const
0180    const_reverse_iterator rend() const BOOST_NOEXCEPT;
0181 
0182    //! @copydoc ::boost::intrusive::bstree::crend()const
0183    const_reverse_iterator crend() const BOOST_NOEXCEPT;
0184 
0185    //! @copydoc ::boost::intrusive::bstree::root()
0186    iterator root() BOOST_NOEXCEPT;
0187 
0188    //! @copydoc ::boost::intrusive::bstree::root()const
0189    const_iterator root() const BOOST_NOEXCEPT;
0190 
0191    //! @copydoc ::boost::intrusive::bstree::croot()const
0192    const_iterator croot() const BOOST_NOEXCEPT;
0193 
0194    //! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(iterator)
0195    static splaytree_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT;
0196 
0197    //! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(const_iterator)
0198    static const splaytree_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT;
0199 
0200    //! @copydoc ::boost::intrusive::bstree::container_from_iterator(iterator)
0201    static splaytree_impl &container_from_iterator(iterator it) BOOST_NOEXCEPT;
0202 
0203    //! @copydoc ::boost::intrusive::bstree::container_from_iterator(const_iterator)
0204    static const splaytree_impl &container_from_iterator(const_iterator it) BOOST_NOEXCEPT;
0205 
0206    //! @copydoc ::boost::intrusive::bstree::key_comp()const
0207    key_compare key_comp() const;
0208 
0209    //! @copydoc ::boost::intrusive::bstree::value_comp()const
0210    value_compare value_comp() const;
0211 
0212    //! @copydoc ::boost::intrusive::bstree::empty()const
0213    bool empty() const BOOST_NOEXCEPT;
0214 
0215    //! @copydoc ::boost::intrusive::bstree::size()const
0216    size_type size() const BOOST_NOEXCEPT;
0217 
0218    //! @copydoc ::boost::intrusive::bstree::swap
0219    void swap(splaytree_impl& other);
0220 
0221    //! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
0222    //! Additional notes: it also copies the alpha factor from the source container.
0223    template <class Cloner, class Disposer>
0224    void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer);
0225 
0226    #else //BOOST_INTRUSIVE_DOXYGEN_INVOKED
0227 
0228    using tree_type::clone_from;
0229 
0230    #endif   //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0231 
0232    //! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
0233    template <class Cloner, class Disposer>
0234    void clone_from(BOOST_RV_REF(splaytree_impl) src, Cloner cloner, Disposer disposer)
0235    {  tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer);  }
0236 
0237    #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0238 
0239    //! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
0240    iterator insert_equal(reference value);
0241 
0242    //! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference)
0243    iterator insert_equal(const_iterator hint, reference value);
0244 
0245    //! @copydoc ::boost::intrusive::bstree::insert_equal(Iterator,Iterator)
0246    template<class Iterator>
0247    void insert_equal(Iterator b, Iterator e);
0248 
0249    //! @copydoc ::boost::intrusive::bstree::insert_unique(reference)
0250    std::pair<iterator, bool> insert_unique(reference value);
0251 
0252    //! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
0253    iterator insert_unique(const_iterator hint, reference value);
0254 
0255    //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const key_type&,insert_commit_data&)
0256    std::pair<iterator, bool> insert_unique_check
0257       (const key_type &key, insert_commit_data &commit_data);
0258 
0259    //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const key_type&,insert_commit_data&)
0260    std::pair<iterator, bool> insert_unique_check
0261       (const_iterator hint, const key_type &key, insert_commit_data &commit_data);
0262 
0263    //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
0264    template<class KeyType, class KeyTypeKeyCompare>
0265    std::pair<iterator, bool> insert_unique_check
0266       (const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data);
0267 
0268    //! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
0269    template<class KeyType, class KeyTypeKeyCompare>
0270    std::pair<iterator, bool> insert_unique_check
0271       (const_iterator hint, const KeyType &key
0272       ,KeyTypeKeyCompare comp, insert_commit_data &commit_data);
0273 
0274    //! @copydoc ::boost::intrusive::bstree::insert_unique_commit
0275    iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) BOOST_NOEXCEPT;
0276 
0277    //! @copydoc ::boost::intrusive::bstree::insert_unique(Iterator,Iterator)
0278    template<class Iterator>
0279    void insert_unique(Iterator b, Iterator e);
0280 
0281    //! @copydoc ::boost::intrusive::bstree::insert_before
0282    iterator insert_before(const_iterator pos, reference value) BOOST_NOEXCEPT;
0283 
0284    //! @copydoc ::boost::intrusive::bstree::push_back
0285    void push_back(reference value) BOOST_NOEXCEPT;
0286 
0287    //! @copydoc ::boost::intrusive::bstree::push_front
0288    void push_front(reference value) BOOST_NOEXCEPT;
0289 
0290    //! @copydoc ::boost::intrusive::bstree::erase(const_iterator)
0291    iterator erase(const_iterator i) BOOST_NOEXCEPT;
0292 
0293    //! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
0294    iterator erase(const_iterator b, const_iterator e) BOOST_NOEXCEPT;
0295 
0296    //! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
0297    size_type erase(const key_type &key);
0298 
0299    //! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
0300    template<class KeyType, class KeyTypeKeyCompare>
0301    size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
0302 
0303    //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
0304    template<class Disposer>
0305    iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT;
0306 
0307    //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,const_iterator,Disposer)
0308    template<class Disposer>
0309    iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer) BOOST_NOEXCEPT;
0310 
0311    //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
0312    template<class Disposer>
0313    size_type erase_and_dispose(const key_type &key, Disposer disposer);
0314 
0315    //! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
0316    template<class KeyType, class KeyTypeKeyCompare, class Disposer>
0317    size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
0318 
0319    //! @copydoc ::boost::intrusive::bstree::clear
0320    void clear() BOOST_NOEXCEPT;
0321 
0322    //! @copydoc ::boost::intrusive::bstree::clear_and_dispose
0323    template<class Disposer>
0324    void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT;
0325 
0326    //! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
0327    //! Additional note: non-const function, splaying is performed.
0328    size_type count(const key_type &key);
0329 
0330    //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
0331    //! Additional note: non-const function, splaying is performed.
0332    template<class KeyType, class KeyTypeKeyCompare>
0333    size_type count(const KeyType &key, KeyTypeKeyCompare comp);
0334 
0335    //! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
0336    //! Additional note: const function, no splaying is performed
0337    size_type count(const key_type &key) const;
0338 
0339    //! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
0340    //! Additional note: const function, no splaying is performed
0341    template<class KeyType, class KeyTypeKeyCompare>
0342    size_type count(const KeyType &key, KeyTypeKeyCompare comp) const;
0343 
0344    //! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
0345    //! Additional note: non-const function, splaying is performed.
0346    iterator lower_bound(const key_type &key);
0347 
0348    //! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
0349    //! Additional note: const function, no splaying is performed
0350    const_iterator lower_bound(const key_type &key) const;
0351 
0352    //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
0353    //! Additional note: non-const function, splaying is performed for the first
0354    //! element of the equal range of "key"
0355    template<class KeyType, class KeyTypeKeyCompare>
0356    iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp);
0357 
0358    //! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
0359    //! Additional note: const function, no splaying is performed
0360    template<class KeyType, class KeyTypeKeyCompare>
0361    const_iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
0362 
0363    //! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
0364    //! Additional note: non-const function, splaying is performed for the first
0365    //! element of the equal range of "value"
0366    iterator upper_bound(const key_type &key);
0367 
0368    //! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
0369    //! Additional note: const function, no splaying is performed
0370    const_iterator upper_bound(const key_type &key) const;
0371 
0372    //! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
0373    //! Additional note: non-const function, splaying is performed for the first
0374    //! element of the equal range of "key"
0375    template<class KeyType, class KeyTypeKeyCompare>
0376    iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp);
0377 
0378    //! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
0379    //! Additional note: const function, no splaying is performed
0380    template<class KeyType, class KeyTypeKeyCompare>
0381    const_iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
0382 
0383    //! @copydoc ::boost::intrusive::bstree::find(const key_type &)
0384    //! Additional note: non-const function, splaying is performed for the first
0385    //! element of the equal range of "value"
0386    iterator find(const key_type &key);
0387 
0388    //! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
0389    //! Additional note: const function, no splaying is performed
0390    const_iterator find(const key_type &key) const;
0391 
0392    //! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
0393    //! Additional note: non-const function, splaying is performed for the first
0394    //! element of the equal range of "key"
0395    template<class KeyType, class KeyTypeKeyCompare>
0396    iterator find(const KeyType &key, KeyTypeKeyCompare comp);
0397 
0398    //! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
0399    //! Additional note: const function, no splaying is performed
0400    template<class KeyType, class KeyTypeKeyCompare>
0401    const_iterator find(const KeyType &key, KeyTypeKeyCompare comp) const;
0402 
0403    //! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
0404    //! Additional note: non-const function, splaying is performed for the first
0405    //! element of the equal range of "value"
0406    std::pair<iterator, iterator> equal_range(const key_type &key);
0407 
0408    //! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
0409    //! Additional note: const function, no splaying is performed
0410    std::pair<const_iterator, const_iterator> equal_range(const key_type &key) const;
0411 
0412    //! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
0413    //! Additional note: non-const function, splaying is performed for the first
0414    //! element of the equal range of "key"
0415    template<class KeyType, class KeyTypeKeyCompare>
0416    std::pair<iterator, iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp);
0417 
0418    //! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
0419    //! Additional note: const function, no splaying is performed
0420    template<class KeyType, class KeyTypeKeyCompare>
0421    std::pair<const_iterator, const_iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp) const;
0422 
0423    //! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
0424    std::pair<iterator,iterator> bounded_range
0425       (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
0426 
0427    //! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
0428    template<class KeyType, class KeyTypeKeyCompare>
0429    std::pair<iterator,iterator> bounded_range
0430       (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
0431 
0432    //! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
0433    std::pair<const_iterator, const_iterator> bounded_range
0434       (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
0435 
0436    //! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
0437    template<class KeyType, class KeyTypeKeyCompare>
0438    std::pair<const_iterator, const_iterator> bounded_range
0439          (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
0440 
0441    //! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
0442    static iterator s_iterator_to(reference value) BOOST_NOEXCEPT;
0443 
0444    //! @copydoc ::boost::intrusive::bstree::s_iterator_to(const_reference)
0445    static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT;
0446 
0447    //! @copydoc ::boost::intrusive::bstree::iterator_to(reference)
0448    iterator iterator_to(reference value) BOOST_NOEXCEPT;
0449 
0450    //! @copydoc ::boost::intrusive::bstree::iterator_to(const_reference)const
0451    const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT;
0452 
0453    //! @copydoc ::boost::intrusive::bstree::init_node(reference)
0454    static void init_node(reference value) BOOST_NOEXCEPT;
0455 
0456    //! @copydoc ::boost::intrusive::bstree::unlink_leftmost_without_rebalance
0457    pointer unlink_leftmost_without_rebalance() BOOST_NOEXCEPT;
0458 
0459    //! @copydoc ::boost::intrusive::bstree::replace_node
0460    void replace_node(iterator replace_this, reference with_this) BOOST_NOEXCEPT;
0461 
0462    //! @copydoc ::boost::intrusive::bstree::remove_node
0463    void remove_node(reference value) BOOST_NOEXCEPT;
0464 
0465    //! @copydoc ::boost::intrusive::bstree::merge_unique(bstree<T, Options2...>&)
0466    template<class T, class ...Options2>
0467    void merge_unique(splaytree<T, Options2...> &);
0468 
0469    //! @copydoc ::boost::intrusive::bstree::merge_equal(bstree<T, Options2...>&)
0470    template<class T, class ...Options2>
0471    void merge_equal(splaytree<T, Options2...> &);
0472 
0473    #endif   //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0474 
0475    //! <b>Requires</b>: i must be a valid iterator of *this.
0476    //!
0477    //! <b>Effects</b>: Rearranges the container so that the element pointed by i
0478    //!   is placed as the root of the tree, improving future searches of this value.
0479    //!
0480    //! <b>Complexity</b>: Amortized logarithmic.
0481    //!
0482    //! <b>Throws</b>: Nothing.
0483    void splay_up(iterator i) BOOST_NOEXCEPT
0484    {  return node_algorithms::splay_up(i.pointed_node(), tree_type::header_ptr());   }
0485 
0486    //! <b>Effects</b>: Rearranges the container so that if *this stores an element
0487    //!   with a key equivalent to value the element is placed as the root of the
0488    //!   tree. If the element is not present returns the last node compared with the key.
0489    //!   If the tree is empty, end() is returned.
0490    //!
0491    //! <b>Complexity</b>: Amortized logarithmic.
0492    //!
0493    //! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
0494    //!
0495    //! <b>Throws</b>: If the comparison functor throws.
0496    template<class KeyType, class KeyTypeKeyCompare>
0497    iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp)
0498    {
0499       detail::key_nodeptr_comp<value_compare, value_traits>
0500          key_node_comp(comp, &this->get_value_traits());
0501       node_ptr r = node_algorithms::splay_down(tree_type::header_ptr(), key, key_node_comp);
0502       return iterator(r, this->priv_value_traits_ptr());
0503    }
0504 
0505    //! <b>Effects</b>: Rearranges the container so that if *this stores an element
0506    //!   with a key equivalent to value the element is placed as the root of the
0507    //!   tree.
0508    //!
0509    //! <b>Complexity</b>: Amortized logarithmic.
0510    //!
0511    //! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
0512    //!
0513    //! <b>Throws</b>: If the predicate throws.
0514    iterator splay_down(const key_type &key)
0515    {  return this->splay_down(key, this->key_comp());   }
0516 
0517    #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0518    //! @copydoc ::boost::intrusive::bstree::rebalance
0519    void rebalance() BOOST_NOEXCEPT;
0520 
0521    //! @copydoc ::boost::intrusive::bstree::rebalance_subtree
0522    iterator rebalance_subtree(iterator root) BOOST_NOEXCEPT;
0523 
0524    friend bool operator< (const splaytree_impl &x, const splaytree_impl &y);
0525 
0526    friend bool operator==(const splaytree_impl &x, const splaytree_impl &y);
0527 
0528    friend bool operator!= (const splaytree_impl &x, const splaytree_impl &y);
0529 
0530    friend bool operator>(const splaytree_impl &x, const splaytree_impl &y);
0531 
0532    friend bool operator<=(const splaytree_impl &x, const splaytree_impl &y);
0533 
0534    friend bool operator>=(const splaytree_impl &x, const splaytree_impl &y);
0535 
0536    friend void swap(splaytree_impl &x, splaytree_impl &y);
0537 
0538    #endif   //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0539 };
0540 
0541 //! Helper metafunction to define a \c splaytree that yields to the same type when the
0542 //! same options (either explicitly or implicitly) are used.
0543 #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0544 template<class T, class ...Options>
0545 #else
0546 template<class T, class O1 = void, class O2 = void
0547                 , class O3 = void, class O4 = void
0548                 , class O5 = void, class O6 = void>
0549 #endif
0550 struct make_splaytree
0551 {
0552    /// @cond
0553    typedef typename pack_options
0554       < splaytree_defaults,
0555       #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0556       O1, O2, O3, O4, O5, O6
0557       #else
0558       Options...
0559       #endif
0560       >::type packed_options;
0561 
0562    typedef typename detail::get_value_traits
0563       <T, typename packed_options::proto_value_traits>::type value_traits;
0564 
0565    typedef splaytree_impl
0566          < value_traits
0567          , typename packed_options::key_of_value
0568          , typename packed_options::compare
0569          , typename packed_options::size_type
0570          , packed_options::constant_time_size
0571          , typename packed_options::header_holder_type
0572          > implementation_defined;
0573    /// @endcond
0574    typedef implementation_defined type;
0575 };
0576 
0577 
0578 #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
0579 
0580 #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0581 template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
0582 #else
0583 template<class T, class ...Options>
0584 #endif
0585 class splaytree
0586    :  public make_splaytree<T,
0587       #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0588       O1, O2, O3, O4, O5, O6
0589       #else
0590       Options...
0591       #endif
0592       >::type
0593 {
0594    typedef typename make_splaytree
0595       <T,
0596       #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
0597       O1, O2, O3, O4, O5, O6
0598       #else
0599       Options...
0600       #endif
0601       >::type   Base;
0602    BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
0603 
0604    public:
0605    typedef typename Base::key_compare        key_compare;
0606    typedef typename Base::value_traits       value_traits;
0607    typedef typename Base::iterator           iterator;
0608    typedef typename Base::const_iterator     const_iterator;
0609    typedef typename Base::reverse_iterator           reverse_iterator;
0610    typedef typename Base::const_reverse_iterator     const_reverse_iterator;
0611 
0612    //Assert if passed value traits are compatible with the type
0613    BOOST_INTRUSIVE_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
0614 
0615    inline splaytree()
0616       :  Base()
0617    {}
0618 
0619    inline explicit splaytree( const key_compare &cmp, const value_traits &v_traits = value_traits())
0620       :  Base(cmp, v_traits)
0621    {}
0622 
0623    template<class Iterator>
0624    inline splaytree( bool unique, Iterator b, Iterator e
0625          , const key_compare &cmp = key_compare()
0626          , const value_traits &v_traits = value_traits())
0627       :  Base(unique, b, e, cmp, v_traits)
0628    {}
0629 
0630    inline splaytree(BOOST_RV_REF(splaytree) x)
0631       :  Base(BOOST_MOVE_BASE(Base, x))
0632    {}
0633 
0634    inline splaytree& operator=(BOOST_RV_REF(splaytree) x)
0635    {  return static_cast<splaytree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x)));  }
0636 
0637    template <class Cloner, class Disposer>
0638    inline void clone_from(const splaytree &src, Cloner cloner, Disposer disposer)
0639    {  Base::clone_from(src, cloner, disposer);  }
0640 
0641    template <class Cloner, class Disposer>
0642    inline void clone_from(BOOST_RV_REF(splaytree) src, Cloner cloner, Disposer disposer)
0643    {  Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer);  }
0644 
0645    inline static splaytree &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
0646    {  return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator));   }
0647 
0648    inline static const splaytree &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
0649    {  return static_cast<const splaytree &>(Base::container_from_end_iterator(end_iterator));   }
0650 
0651    inline static splaytree &container_from_iterator(iterator it) BOOST_NOEXCEPT
0652    {  return static_cast<splaytree &>(Base::container_from_iterator(it));   }
0653 
0654    inline static const splaytree &container_from_iterator(const_iterator it) BOOST_NOEXCEPT
0655    {  return static_cast<const splaytree &>(Base::container_from_iterator(it));   }
0656 };
0657 
0658 #endif
0659 
0660 } //namespace intrusive
0661 } //namespace boost
0662 
0663 #include <boost/intrusive/detail/config_end.hpp>
0664 
0665 #endif //BOOST_INTRUSIVE_SPLAYTREE_HPP