Back to home page

EIC code displayed by LXR

 
 

    


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

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