Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:46

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