avl_set.hpp 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2007-2014
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // See http://www.boost.org/libs/intrusive for documentation.
  10. //
  11. /////////////////////////////////////////////////////////////////////////////
  12. #ifndef BOOST_INTRUSIVE_AVL_SET_HPP
  13. #define BOOST_INTRUSIVE_AVL_SET_HPP
  14. #include <boost/intrusive/detail/config_begin.hpp>
  15. #include <boost/intrusive/intrusive_fwd.hpp>
  16. #include <boost/intrusive/avltree.hpp>
  17. #include <boost/intrusive/detail/mpl.hpp>
  18. #include <boost/move/utility_core.hpp>
  19. #include <boost/static_assert.hpp>
  20. #if defined(BOOST_HAS_PRAGMA_ONCE)
  21. # pragma once
  22. #endif
  23. namespace boost {
  24. namespace intrusive {
  25. //! The class template avl_set is an intrusive container, that mimics most of
  26. //! the interface of std::set as described in the C++ standard.
  27. //!
  28. //! The template parameter \c T is the type to be managed by the container.
  29. //! The user can specify additional options and if no options are provided
  30. //! default options are used.
  31. //!
  32. //! The container supports the following options:
  33. //! \c base_hook<>/member_hook<>/value_traits<>,
  34. //! \c constant_time_size<>, \c size_type<> and
  35. //! \c compare<>.
  36. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  37. template<class T, class ...Options>
  38. #else
  39. template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
  40. #endif
  41. class avl_set_impl
  42. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  43. : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
  44. #endif
  45. {
  46. /// @cond
  47. typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
  48. BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set_impl)
  49. typedef tree_type implementation_defined;
  50. /// @endcond
  51. public:
  52. typedef typename implementation_defined::value_type value_type;
  53. typedef typename implementation_defined::key_type key_type;
  54. typedef typename implementation_defined::key_of_value key_of_value;
  55. typedef typename implementation_defined::value_traits value_traits;
  56. typedef typename implementation_defined::pointer pointer;
  57. typedef typename implementation_defined::const_pointer const_pointer;
  58. typedef typename implementation_defined::reference reference;
  59. typedef typename implementation_defined::const_reference const_reference;
  60. typedef typename implementation_defined::difference_type difference_type;
  61. typedef typename implementation_defined::size_type size_type;
  62. typedef typename implementation_defined::value_compare value_compare;
  63. typedef typename implementation_defined::key_compare key_compare;
  64. typedef typename implementation_defined::iterator iterator;
  65. typedef typename implementation_defined::const_iterator const_iterator;
  66. typedef typename implementation_defined::reverse_iterator reverse_iterator;
  67. typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
  68. typedef typename implementation_defined::insert_commit_data insert_commit_data;
  69. typedef typename implementation_defined::node_traits node_traits;
  70. typedef typename implementation_defined::node node;
  71. typedef typename implementation_defined::node_ptr node_ptr;
  72. typedef typename implementation_defined::const_node_ptr const_node_ptr;
  73. typedef typename implementation_defined::node_algorithms node_algorithms;
  74. static const bool constant_time_size = tree_type::constant_time_size;
  75. public:
  76. //! @copydoc ::boost::intrusive::avltree::avltree()
  77. avl_set_impl()
  78. : tree_type()
  79. {}
  80. //! @copydoc ::boost::intrusive::avltree::avltree(const key_compare &,const value_traits &)
  81. explicit avl_set_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
  82. : tree_type(cmp, v_traits)
  83. {}
  84. //! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
  85. template<class Iterator>
  86. avl_set_impl( Iterator b, Iterator e
  87. , const key_compare &cmp = key_compare()
  88. , const value_traits &v_traits = value_traits())
  89. : tree_type(true, b, e, cmp, v_traits)
  90. {}
  91. //! @copydoc ::boost::intrusive::avltree::avltree(avltree &&)
  92. avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
  93. : tree_type(BOOST_MOVE_BASE(tree_type, x))
  94. {}
  95. //! @copydoc ::boost::intrusive::avltree::operator=(avltree &&)
  96. avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
  97. { return static_cast<avl_set_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
  98. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  99. //! @copydoc ::boost::intrusive::avltree::~avltree()
  100. ~avl_set_impl();
  101. //! @copydoc ::boost::intrusive::avltree::begin()
  102. iterator begin();
  103. //! @copydoc ::boost::intrusive::avltree::begin()const
  104. const_iterator begin() const;
  105. //! @copydoc ::boost::intrusive::avltree::cbegin()const
  106. const_iterator cbegin() const;
  107. //! @copydoc ::boost::intrusive::avltree::end()
  108. iterator end();
  109. //! @copydoc ::boost::intrusive::avltree::end()const
  110. const_iterator end() const;
  111. //! @copydoc ::boost::intrusive::avltree::cend()const
  112. const_iterator cend() const;
  113. //! @copydoc ::boost::intrusive::avltree::begin()
  114. reverse_iterator avlegin();
  115. //! @copydoc ::boost::intrusive::avltree::begin()const
  116. const_reverse_iterator avlegin() const;
  117. //! @copydoc ::boost::intrusive::avltree::crbegin()const
  118. const_reverse_iterator crbegin() const;
  119. //! @copydoc ::boost::intrusive::avltree::rend()
  120. reverse_iterator rend();
  121. //! @copydoc ::boost::intrusive::avltree::rend()const
  122. const_reverse_iterator rend() const;
  123. //! @copydoc ::boost::intrusive::avltree::crend()const
  124. const_reverse_iterator crend() const;
  125. //! @copydoc ::boost::intrusive::avltree::container_from_end_iterator(iterator)
  126. static avl_set_impl &container_from_end_iterator(iterator end_iterator);
  127. //! @copydoc ::boost::intrusive::avltree::container_from_end_iterator(const_iterator)
  128. static const avl_set_impl &container_from_end_iterator(const_iterator end_iterator);
  129. //! @copydoc ::boost::intrusive::avltree::container_from_iterator(iterator)
  130. static avl_set_impl &container_from_iterator(iterator it);
  131. //! @copydoc ::boost::intrusive::avltree::container_from_iterator(const_iterator)
  132. static const avl_set_impl &container_from_iterator(const_iterator it);
  133. //! @copydoc ::boost::intrusive::avltree::key_comp()const
  134. key_compare key_comp() const;
  135. //! @copydoc ::boost::intrusive::avltree::value_comp()const
  136. value_compare value_comp() const;
  137. //! @copydoc ::boost::intrusive::avltree::empty()const
  138. bool empty() const;
  139. //! @copydoc ::boost::intrusive::avltree::size()const
  140. size_type size() const;
  141. //! @copydoc ::boost::intrusive::avltree::swap
  142. void swap(avl_set_impl& other);
  143. //! @copydoc ::boost::intrusive::avltree::clone_from(const avltree&,Cloner,Disposer)
  144. template <class Cloner, class Disposer>
  145. void clone_from(const avl_set_impl &src, Cloner cloner, Disposer disposer);
  146. #else
  147. using tree_type::clone_from;
  148. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  149. //! @copydoc ::boost::intrusive::avltree::clone_from(avltree&&,Cloner,Disposer)
  150. template <class Cloner, class Disposer>
  151. void clone_from(BOOST_RV_REF(avl_set_impl) src, Cloner cloner, Disposer disposer)
  152. { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
  153. //! @copydoc ::boost::intrusive::avltree::insert_unique(reference)
  154. std::pair<iterator, bool> insert(reference value)
  155. { return tree_type::insert_unique(value); }
  156. //! @copydoc ::boost::intrusive::avltree::insert_unique(const_iterator,reference)
  157. iterator insert(const_iterator hint, reference value)
  158. { return tree_type::insert_unique(hint, value); }
  159. //! @copydoc ::boost::intrusive::avltree::insert_unique_check(const key_type&,insert_commit_data&)
  160. std::pair<iterator, bool> insert_check
  161. (const key_type &key, insert_commit_data &commit_data)
  162. { return tree_type::insert_unique_check(key, commit_data); }
  163. //! @copydoc ::boost::intrusive::avltree::insert_unique_check(const_iterator,const key_type&,insert_commit_data&)
  164. std::pair<iterator, bool> insert_check
  165. (const_iterator hint, const key_type &key
  166. ,insert_commit_data &commit_data)
  167. { return tree_type::insert_unique_check(hint, key, commit_data); }
  168. //! @copydoc ::boost::intrusive::avltree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
  169. template<class KeyType, class KeyTypeKeyCompare>
  170. std::pair<iterator, bool> insert_check
  171. (const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data)
  172. { return tree_type::insert_unique_check(key, comp, commit_data); }
  173. //! @copydoc ::boost::intrusive::avltree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
  174. template<class KeyType, class KeyTypeKeyCompare>
  175. std::pair<iterator, bool> insert_check
  176. (const_iterator hint, const KeyType &key
  177. ,KeyTypeKeyCompare comp, insert_commit_data &commit_data)
  178. { return tree_type::insert_unique_check(hint, key, comp, commit_data); }
  179. //! @copydoc ::boost::intrusive::avltree::insert_unique(Iterator,Iterator)
  180. template<class Iterator>
  181. void insert(Iterator b, Iterator e)
  182. { tree_type::insert_unique(b, e); }
  183. //! @copydoc ::boost::intrusive::avltree::insert_unique_commit
  184. iterator insert_commit(reference value, const insert_commit_data &commit_data)
  185. { return tree_type::insert_unique_commit(value, commit_data); }
  186. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  187. //! @copydoc ::boost::intrusive::avltree::insert_before
  188. iterator insert_before(const_iterator pos, reference value);
  189. //! @copydoc ::boost::intrusive::avltree::push_back
  190. void push_back(reference value);
  191. //! @copydoc ::boost::intrusive::avltree::push_front
  192. void push_front(reference value);
  193. //! @copydoc ::boost::intrusive::avltree::erase(const_iterator)
  194. iterator erase(const_iterator i);
  195. //! @copydoc ::boost::intrusive::avltree::erase(const_iterator,const_iterator)
  196. iterator erase(const_iterator b, const_iterator e);
  197. //! @copydoc ::boost::intrusive::avltree::erase(const key_type &key)
  198. size_type erase(const key_type &key);
  199. //! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyTypeKeyCompare)
  200. template<class KeyType, class KeyTypeKeyCompare>
  201. size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
  202. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,Disposer)
  203. template<class Disposer>
  204. iterator erase_and_dispose(const_iterator i, Disposer disposer);
  205. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,const_iterator,Disposer)
  206. template<class Disposer>
  207. iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
  208. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const key_type &, Disposer)
  209. template<class Disposer>
  210. size_type erase_and_dispose(const key_type &key, Disposer disposer);
  211. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
  212. template<class KeyType, class KeyTypeKeyCompare, class Disposer>
  213. size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
  214. //! @copydoc ::boost::intrusive::avltree::clear
  215. void clear();
  216. //! @copydoc ::boost::intrusive::avltree::clear_and_dispose
  217. template<class Disposer>
  218. void clear_and_dispose(Disposer disposer);
  219. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  220. //! @copydoc ::boost::intrusive::avltree::count(const key_type &)const
  221. size_type count(const key_type &key) const
  222. { return static_cast<size_type>(this->tree_type::find(key) != this->tree_type::cend()); }
  223. //! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyTypeKeyCompare)const
  224. template<class KeyType, class KeyTypeKeyCompare>
  225. size_type count(const KeyType& key, KeyTypeKeyCompare comp) const
  226. { return static_cast<size_type>(this->tree_type::find(key, comp) != this->tree_type::cend()); }
  227. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  228. //! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)
  229. iterator lower_bound(const key_type &key);
  230. //! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)
  231. template<class KeyType, class KeyTypeKeyCompare>
  232. iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
  233. //! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)const
  234. const_iterator lower_bound(const key_type &key) const;
  235. //! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
  236. template<class KeyType, class KeyTypeKeyCompare>
  237. const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  238. //! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)
  239. iterator upper_bound(const key_type &key);
  240. //! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)
  241. template<class KeyType, class KeyTypeKeyCompare>
  242. iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
  243. //! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)const
  244. const_iterator upper_bound(const key_type &key) const;
  245. //! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
  246. template<class KeyType, class KeyTypeKeyCompare>
  247. const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  248. //! @copydoc ::boost::intrusive::avltree::find(const key_type &)
  249. iterator find(const key_type &key);
  250. //! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)
  251. template<class KeyType, class KeyTypeKeyCompare>
  252. iterator find(const KeyType& key, KeyTypeKeyCompare comp);
  253. //! @copydoc ::boost::intrusive::avltree::find(const key_type &)const
  254. const_iterator find(const key_type &key) const;
  255. //! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)const
  256. template<class KeyType, class KeyTypeKeyCompare>
  257. const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
  258. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  259. //! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)
  260. std::pair<iterator,iterator> equal_range(const key_type &key)
  261. { return this->tree_type::lower_bound_range(key); }
  262. //! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)
  263. template<class KeyType, class KeyTypeKeyCompare>
  264. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
  265. { return this->tree_type::equal_range(key, comp); }
  266. //! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)const
  267. std::pair<const_iterator, const_iterator>
  268. equal_range(const key_type &key) const
  269. { return this->tree_type::lower_bound_range(key); }
  270. //! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)const
  271. template<class KeyType, class KeyTypeKeyCompare>
  272. std::pair<const_iterator, const_iterator>
  273. equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
  274. { return this->tree_type::equal_range(key, comp); }
  275. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  276. //! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)
  277. std::pair<iterator,iterator> bounded_range
  278. (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
  279. //! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
  280. template<class KeyType, class KeyTypeKeyCompare>
  281. std::pair<iterator,iterator> bounded_range
  282. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
  283. //! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)const
  284. std::pair<const_iterator, const_iterator>
  285. bounded_range(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
  286. //! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
  287. template<class KeyType, class KeyTypeKeyCompare>
  288. std::pair<const_iterator, const_iterator> bounded_range
  289. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
  290. //! @copydoc ::boost::intrusive::avltree::s_iterator_to(reference)
  291. static iterator s_iterator_to(reference value);
  292. //! @copydoc ::boost::intrusive::avltree::s_iterator_to(const_reference)
  293. static const_iterator s_iterator_to(const_reference value);
  294. //! @copydoc ::boost::intrusive::avltree::iterator_to(reference)
  295. iterator iterator_to(reference value);
  296. //! @copydoc ::boost::intrusive::avltree::iterator_to(const_reference)const
  297. const_iterator iterator_to(const_reference value) const;
  298. //! @copydoc ::boost::intrusive::avltree::init_node(reference)
  299. static void init_node(reference value);
  300. //! @copydoc ::boost::intrusive::avltree::unlink_leftmost_without_rebalance
  301. pointer unlink_leftmost_without_rebalance();
  302. //! @copydoc ::boost::intrusive::avltree::replace_node
  303. void replace_node(iterator replace_this, reference with_this);
  304. //! @copydoc ::boost::intrusive::avltree::remove_node
  305. void remove_node(reference value);
  306. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  307. };
  308. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  309. template<class T, class ...Options>
  310. bool operator!= (const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
  311. template<class T, class ...Options>
  312. bool operator>(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
  313. template<class T, class ...Options>
  314. bool operator<=(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
  315. template<class T, class ...Options>
  316. bool operator>=(const avl_set_impl<T, Options...> &x, const avl_set_impl<T, Options...> &y);
  317. template<class T, class ...Options>
  318. void swap(avl_set_impl<T, Options...> &x, avl_set_impl<T, Options...> &y);
  319. #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  320. //! Helper metafunction to define a \c set that yields to the same type when the
  321. //! same options (either explicitly or implicitly) are used.
  322. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  323. template<class T, class ...Options>
  324. #else
  325. template<class T, class O1 = void, class O2 = void
  326. , class O3 = void, class O4 = void
  327. , class O5 = void, class O6 = void>
  328. #endif
  329. struct make_avl_set
  330. {
  331. /// @cond
  332. typedef typename pack_options
  333. < avltree_defaults,
  334. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  335. O1, O2, O3, O4, O5, O6
  336. #else
  337. Options...
  338. #endif
  339. >::type packed_options;
  340. typedef typename detail::get_value_traits
  341. <T, typename packed_options::proto_value_traits>::type value_traits;
  342. typedef avl_set_impl
  343. < value_traits
  344. , typename packed_options::key_of_value
  345. , typename packed_options::compare
  346. , typename packed_options::size_type
  347. , packed_options::constant_time_size
  348. , typename packed_options::header_holder_type
  349. > implementation_defined;
  350. /// @endcond
  351. typedef implementation_defined type;
  352. };
  353. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  354. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  355. template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
  356. #else
  357. template<class T, class ...Options>
  358. #endif
  359. class avl_set
  360. : public make_avl_set<T,
  361. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  362. O1, O2, O3, O4, O5, O6
  363. #else
  364. Options...
  365. #endif
  366. >::type
  367. {
  368. typedef typename make_avl_set
  369. <T,
  370. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  371. O1, O2, O3, O4, O5, O6
  372. #else
  373. Options...
  374. #endif
  375. >::type Base;
  376. BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set)
  377. public:
  378. typedef typename Base::key_compare key_compare;
  379. typedef typename Base::value_traits value_traits;
  380. typedef typename Base::iterator iterator;
  381. typedef typename Base::const_iterator const_iterator;
  382. //Assert if passed value traits are compatible with the type
  383. BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
  384. avl_set()
  385. : Base()
  386. {}
  387. explicit avl_set( const key_compare &cmp, const value_traits &v_traits = value_traits())
  388. : Base(cmp, v_traits)
  389. {}
  390. template<class Iterator>
  391. avl_set( Iterator b, Iterator e
  392. , const key_compare &cmp = key_compare()
  393. , const value_traits &v_traits = value_traits())
  394. : Base(b, e, cmp, v_traits)
  395. {}
  396. avl_set(BOOST_RV_REF(avl_set) x)
  397. : Base(BOOST_MOVE_BASE(Base, x))
  398. {}
  399. avl_set& operator=(BOOST_RV_REF(avl_set) x)
  400. { return static_cast<avl_set &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
  401. template <class Cloner, class Disposer>
  402. void clone_from(const avl_set &src, Cloner cloner, Disposer disposer)
  403. { Base::clone_from(src, cloner, disposer); }
  404. template <class Cloner, class Disposer>
  405. void clone_from(BOOST_RV_REF(avl_set) src, Cloner cloner, Disposer disposer)
  406. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  407. static avl_set &container_from_end_iterator(iterator end_iterator)
  408. { return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); }
  409. static const avl_set &container_from_end_iterator(const_iterator end_iterator)
  410. { return static_cast<const avl_set &>(Base::container_from_end_iterator(end_iterator)); }
  411. static avl_set &container_from_iterator(iterator it)
  412. { return static_cast<avl_set &>(Base::container_from_iterator(it)); }
  413. static const avl_set &container_from_iterator(const_iterator it)
  414. { return static_cast<const avl_set &>(Base::container_from_iterator(it)); }
  415. };
  416. #endif
  417. //! The class template avl_multiset is an intrusive container, that mimics most of
  418. //! the interface of std::_multiset as described in the C++ standard.
  419. //!
  420. //! The template parameter \c T is the type to be managed by the container.
  421. //! The user can specify additional options and if no options are provided
  422. //! default options are used.
  423. //!
  424. //! The container supports the following options:
  425. //! \c base_hook<>/member_hook<>/value_traits<>,
  426. //! \c constant_time_size<>, \c size_type<> and
  427. //! \c compare<>.
  428. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  429. template<class T, class ...Options>
  430. #else
  431. template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
  432. #endif
  433. class avl_multiset_impl
  434. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  435. : public bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder>
  436. #endif
  437. {
  438. /// @cond
  439. typedef bstree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, AvlTreeAlgorithms, HeaderHolder> tree_type;
  440. BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset_impl)
  441. typedef tree_type implementation_defined;
  442. /// @endcond
  443. public:
  444. typedef typename implementation_defined::value_type value_type;
  445. typedef typename implementation_defined::key_type key_type;
  446. typedef typename implementation_defined::key_of_value key_of_value;
  447. typedef typename implementation_defined::value_traits value_traits;
  448. typedef typename implementation_defined::pointer pointer;
  449. typedef typename implementation_defined::const_pointer const_pointer;
  450. typedef typename implementation_defined::reference reference;
  451. typedef typename implementation_defined::const_reference const_reference;
  452. typedef typename implementation_defined::difference_type difference_type;
  453. typedef typename implementation_defined::size_type size_type;
  454. typedef typename implementation_defined::value_compare value_compare;
  455. typedef typename implementation_defined::key_compare key_compare;
  456. typedef typename implementation_defined::iterator iterator;
  457. typedef typename implementation_defined::const_iterator const_iterator;
  458. typedef typename implementation_defined::reverse_iterator reverse_iterator;
  459. typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
  460. typedef typename implementation_defined::insert_commit_data insert_commit_data;
  461. typedef typename implementation_defined::node_traits node_traits;
  462. typedef typename implementation_defined::node node;
  463. typedef typename implementation_defined::node_ptr node_ptr;
  464. typedef typename implementation_defined::const_node_ptr const_node_ptr;
  465. typedef typename implementation_defined::node_algorithms node_algorithms;
  466. static const bool constant_time_size = tree_type::constant_time_size;
  467. public:
  468. //! @copydoc ::boost::intrusive::avltree::avltree()
  469. avl_multiset_impl()
  470. : tree_type()
  471. {}
  472. //! @copydoc ::boost::intrusive::avltree::avltree(const key_compare &,const value_traits &)
  473. explicit avl_multiset_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
  474. : tree_type(cmp, v_traits)
  475. {}
  476. //! @copydoc ::boost::intrusive::avltree::avltree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
  477. template<class Iterator>
  478. avl_multiset_impl( Iterator b, Iterator e
  479. , const key_compare &cmp = key_compare()
  480. , const value_traits &v_traits = value_traits())
  481. : tree_type(false, b, e, cmp, v_traits)
  482. {}
  483. //! @copydoc ::boost::intrusive::avltree::avltree(avltree &&)
  484. avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
  485. : tree_type(BOOST_MOVE_BASE(tree_type, x))
  486. {}
  487. //! @copydoc ::boost::intrusive::avltree::operator=(avltree &&)
  488. avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
  489. { return static_cast<avl_multiset_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
  490. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  491. //! @copydoc ::boost::intrusive::avltree::~avltree()
  492. ~avl_multiset_impl();
  493. //! @copydoc ::boost::intrusive::avltree::begin()
  494. iterator begin();
  495. //! @copydoc ::boost::intrusive::avltree::begin()const
  496. const_iterator begin() const;
  497. //! @copydoc ::boost::intrusive::avltree::cbegin()const
  498. const_iterator cbegin() const;
  499. //! @copydoc ::boost::intrusive::avltree::end()
  500. iterator end();
  501. //! @copydoc ::boost::intrusive::avltree::end()const
  502. const_iterator end() const;
  503. //! @copydoc ::boost::intrusive::avltree::cend()const
  504. const_iterator cend() const;
  505. //! @copydoc ::boost::intrusive::avltree::rbegin()
  506. reverse_iterator rbegin();
  507. //! @copydoc ::boost::intrusive::avltree::rbegin()const
  508. const_reverse_iterator rbegin() const;
  509. //! @copydoc ::boost::intrusive::avltree::crbegin()const
  510. const_reverse_iterator crbegin() const;
  511. //! @copydoc ::boost::intrusive::avltree::rend()
  512. reverse_iterator rend();
  513. //! @copydoc ::boost::intrusive::avltree::rend()const
  514. const_reverse_iterator rend() const;
  515. //! @copydoc ::boost::intrusive::avltree::crend()const
  516. const_reverse_iterator crend() const;
  517. //! @copydoc ::boost::intrusive::avltree::container_from_end_iterator(iterator)
  518. static avl_multiset_impl &container_from_end_iterator(iterator end_iterator);
  519. //! @copydoc ::boost::intrusive::avltree::container_from_end_iterator(const_iterator)
  520. static const avl_multiset_impl &container_from_end_iterator(const_iterator end_iterator);
  521. //! @copydoc ::boost::intrusive::avltree::container_from_iterator(iterator)
  522. static avl_multiset_impl &container_from_iterator(iterator it);
  523. //! @copydoc ::boost::intrusive::avltree::container_from_iterator(const_iterator)
  524. static const avl_multiset_impl &container_from_iterator(const_iterator it);
  525. //! @copydoc ::boost::intrusive::avltree::key_comp()const
  526. key_compare key_comp() const;
  527. //! @copydoc ::boost::intrusive::avltree::value_comp()const
  528. value_compare value_comp() const;
  529. //! @copydoc ::boost::intrusive::avltree::empty()const
  530. bool empty() const;
  531. //! @copydoc ::boost::intrusive::avltree::size()const
  532. size_type size() const;
  533. //! @copydoc ::boost::intrusive::avltree::swap
  534. void swap(avl_multiset_impl& other);
  535. //! @copydoc ::boost::intrusive::avltree::clone_from(const avltree&,Cloner,Disposer)
  536. template <class Cloner, class Disposer>
  537. void clone_from(const avl_multiset_impl &src, Cloner cloner, Disposer disposer);
  538. #else
  539. using tree_type::clone_from;
  540. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  541. //! @copydoc ::boost::intrusive::avltree::clone_from(avltree&&,Cloner,Disposer)
  542. template <class Cloner, class Disposer>
  543. void clone_from(BOOST_RV_REF(avl_multiset_impl) src, Cloner cloner, Disposer disposer)
  544. { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
  545. //! @copydoc ::boost::intrusive::avltree::insert_equal(reference)
  546. iterator insert(reference value)
  547. { return tree_type::insert_equal(value); }
  548. //! @copydoc ::boost::intrusive::avltree::insert_equal(const_iterator,reference)
  549. iterator insert(const_iterator hint, reference value)
  550. { return tree_type::insert_equal(hint, value); }
  551. //! @copydoc ::boost::intrusive::avltree::insert_equal(Iterator,Iterator)
  552. template<class Iterator>
  553. void insert(Iterator b, Iterator e)
  554. { tree_type::insert_equal(b, e); }
  555. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  556. //! @copydoc ::boost::intrusive::avltree::insert_before
  557. iterator insert_before(const_iterator pos, reference value);
  558. //! @copydoc ::boost::intrusive::avltree::push_back
  559. void push_back(reference value);
  560. //! @copydoc ::boost::intrusive::avltree::push_front
  561. void push_front(reference value);
  562. //! @copydoc ::boost::intrusive::avltree::erase(const_iterator)
  563. iterator erase(const_iterator i);
  564. //! @copydoc ::boost::intrusive::avltree::erase(const_iterator,const_iterator)
  565. iterator erase(const_iterator b, const_iterator e);
  566. //! @copydoc ::boost::intrusive::avltree::erase(const key_type &)
  567. size_type erase(const key_type &key);
  568. //! @copydoc ::boost::intrusive::avltree::erase(const KeyType&,KeyTypeKeyCompare)
  569. template<class KeyType, class KeyTypeKeyCompare>
  570. size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
  571. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,Disposer)
  572. template<class Disposer>
  573. iterator erase_and_dispose(const_iterator i, Disposer disposer);
  574. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const_iterator,const_iterator,Disposer)
  575. template<class Disposer>
  576. iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
  577. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const key_type &, Disposer)
  578. template<class Disposer>
  579. size_type erase_and_dispose(const key_type &key, Disposer disposer);
  580. //! @copydoc ::boost::intrusive::avltree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
  581. template<class KeyType, class KeyTypeKeyCompare, class Disposer>
  582. size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
  583. //! @copydoc ::boost::intrusive::avltree::clear
  584. void clear();
  585. //! @copydoc ::boost::intrusive::avltree::clear_and_dispose
  586. template<class Disposer>
  587. void clear_and_dispose(Disposer disposer);
  588. //! @copydoc ::boost::intrusive::avltree::count(const key_type &)const
  589. size_type count(const key_type &key) const;
  590. //! @copydoc ::boost::intrusive::avltree::count(const KeyType&,KeyTypeKeyCompare)const
  591. template<class KeyType, class KeyTypeKeyCompare>
  592. size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
  593. //! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)
  594. iterator lower_bound(const key_type &key);
  595. //! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)
  596. template<class KeyType, class KeyTypeKeyCompare>
  597. iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
  598. //! @copydoc ::boost::intrusive::avltree::lower_bound(const key_type &)const
  599. const_iterator lower_bound(const key_type &key) const;
  600. //! @copydoc ::boost::intrusive::avltree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
  601. template<class KeyType, class KeyTypeKeyCompare>
  602. const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  603. //! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)
  604. iterator upper_bound(const key_type &key);
  605. //! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)
  606. template<class KeyType, class KeyTypeKeyCompare>
  607. iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
  608. //! @copydoc ::boost::intrusive::avltree::upper_bound(const key_type &)const
  609. const_iterator upper_bound(const key_type &key) const;
  610. //! @copydoc ::boost::intrusive::avltree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
  611. template<class KeyType, class KeyTypeKeyCompare>
  612. const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  613. //! @copydoc ::boost::intrusive::avltree::find(const key_type &)
  614. iterator find(const key_type &key);
  615. //! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)
  616. template<class KeyType, class KeyTypeKeyCompare>
  617. iterator find(const KeyType& key, KeyTypeKeyCompare comp);
  618. //! @copydoc ::boost::intrusive::avltree::find(const key_type &)const
  619. const_iterator find(const key_type &key) const;
  620. //! @copydoc ::boost::intrusive::avltree::find(const KeyType&,KeyTypeKeyCompare)const
  621. template<class KeyType, class KeyTypeKeyCompare>
  622. const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
  623. //! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)
  624. std::pair<iterator,iterator> equal_range(const key_type &key);
  625. //! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)
  626. template<class KeyType, class KeyTypeKeyCompare>
  627. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
  628. //! @copydoc ::boost::intrusive::avltree::equal_range(const key_type &)const
  629. std::pair<const_iterator, const_iterator>
  630. equal_range(const key_type &key) const;
  631. //! @copydoc ::boost::intrusive::avltree::equal_range(const KeyType&,KeyTypeKeyCompare)const
  632. template<class KeyType, class KeyTypeKeyCompare>
  633. std::pair<const_iterator, const_iterator>
  634. equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
  635. //! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)
  636. std::pair<iterator,iterator> bounded_range
  637. (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
  638. //! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
  639. template<class KeyType, class KeyTypeKeyCompare>
  640. std::pair<iterator,iterator> bounded_range
  641. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
  642. //! @copydoc ::boost::intrusive::avltree::bounded_range(const key_type &,const key_type &,bool,bool)const
  643. std::pair<const_iterator, const_iterator>
  644. bounded_range(const key_type &lower_key, const key_type &key upper_key, bool left_closed, bool right_closed) const;
  645. //! @copydoc ::boost::intrusive::avltree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
  646. template<class KeyType, class KeyTypeKeyCompare>
  647. std::pair<const_iterator, const_iterator> bounded_range
  648. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
  649. //! @copydoc ::boost::intrusive::avltree::s_iterator_to(reference)
  650. static iterator s_iterator_to(reference value);
  651. //! @copydoc ::boost::intrusive::avltree::s_iterator_to(const_reference)
  652. static const_iterator s_iterator_to(const_reference value);
  653. //! @copydoc ::boost::intrusive::avltree::iterator_to(reference)
  654. iterator iterator_to(reference value);
  655. //! @copydoc ::boost::intrusive::avltree::iterator_to(const_reference)const
  656. const_iterator iterator_to(const_reference value) const;
  657. //! @copydoc ::boost::intrusive::avltree::init_node(reference)
  658. static void init_node(reference value);
  659. //! @copydoc ::boost::intrusive::avltree::unlink_leftmost_without_rebalance
  660. pointer unlink_leftmost_without_rebalance();
  661. //! @copydoc ::boost::intrusive::avltree::replace_node
  662. void replace_node(iterator replace_this, reference with_this);
  663. //! @copydoc ::boost::intrusive::avltree::remove_node
  664. void remove_node(reference value);
  665. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  666. };
  667. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  668. template<class T, class ...Options>
  669. bool operator!= (const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
  670. template<class T, class ...Options>
  671. bool operator>(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
  672. template<class T, class ...Options>
  673. bool operator<=(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
  674. template<class T, class ...Options>
  675. bool operator>=(const avl_multiset_impl<T, Options...> &x, const avl_multiset_impl<T, Options...> &y);
  676. template<class T, class ...Options>
  677. void swap(avl_multiset_impl<T, Options...> &x, avl_multiset_impl<T, Options...> &y);
  678. #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  679. //! Helper metafunction to define a \c avl_multiset that yields to the same type when the
  680. //! same options (either explicitly or implicitly) are used.
  681. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  682. template<class T, class ...Options>
  683. #else
  684. template<class T, class O1 = void, class O2 = void
  685. , class O3 = void, class O4 = void
  686. , class O5 = void, class O6 = void>
  687. #endif
  688. struct make_avl_multiset
  689. {
  690. /// @cond
  691. typedef typename pack_options
  692. < avltree_defaults,
  693. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  694. O1, O2, O3, O4, O5, O6
  695. #else
  696. Options...
  697. #endif
  698. >::type packed_options;
  699. typedef typename detail::get_value_traits
  700. <T, typename packed_options::proto_value_traits>::type value_traits;
  701. typedef avl_multiset_impl
  702. < value_traits
  703. , typename packed_options::key_of_value
  704. , typename packed_options::compare
  705. , typename packed_options::size_type
  706. , packed_options::constant_time_size
  707. , typename packed_options::header_holder_type
  708. > implementation_defined;
  709. /// @endcond
  710. typedef implementation_defined type;
  711. };
  712. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  713. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  714. template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
  715. #else
  716. template<class T, class ...Options>
  717. #endif
  718. class avl_multiset
  719. : public make_avl_multiset<T,
  720. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  721. O1, O2, O3, O4, O5, O6
  722. #else
  723. Options...
  724. #endif
  725. >::type
  726. {
  727. typedef typename make_avl_multiset<T,
  728. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  729. O1, O2, O3, O4, O5, O6
  730. #else
  731. Options...
  732. #endif
  733. >::type Base;
  734. BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset)
  735. public:
  736. typedef typename Base::key_compare key_compare;
  737. typedef typename Base::value_traits value_traits;
  738. typedef typename Base::iterator iterator;
  739. typedef typename Base::const_iterator const_iterator;
  740. //Assert if passed value traits are compatible with the type
  741. BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
  742. avl_multiset()
  743. : Base()
  744. {}
  745. explicit avl_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits())
  746. : Base(cmp, v_traits)
  747. {}
  748. template<class Iterator>
  749. avl_multiset( Iterator b, Iterator e
  750. , const key_compare &cmp = key_compare()
  751. , const value_traits &v_traits = value_traits())
  752. : Base(b, e, cmp, v_traits)
  753. {}
  754. avl_multiset(BOOST_RV_REF(avl_multiset) x)
  755. : Base(BOOST_MOVE_BASE(Base, x))
  756. {}
  757. avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x)
  758. { return static_cast<avl_multiset &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
  759. template <class Cloner, class Disposer>
  760. void clone_from(const avl_multiset &src, Cloner cloner, Disposer disposer)
  761. { Base::clone_from(src, cloner, disposer); }
  762. template <class Cloner, class Disposer>
  763. void clone_from(BOOST_RV_REF(avl_multiset) src, Cloner cloner, Disposer disposer)
  764. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  765. static avl_multiset &container_from_end_iterator(iterator end_iterator)
  766. { return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
  767. static const avl_multiset &container_from_end_iterator(const_iterator end_iterator)
  768. { return static_cast<const avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
  769. static avl_multiset &container_from_iterator(iterator it)
  770. { return static_cast<avl_multiset &>(Base::container_from_iterator(it)); }
  771. static const avl_multiset &container_from_iterator(const_iterator it)
  772. { return static_cast<const avl_multiset &>(Base::container_from_iterator(it)); }
  773. };
  774. #endif
  775. } //namespace intrusive
  776. } //namespace boost
  777. #include <boost/intrusive/detail/config_end.hpp>
  778. #endif //BOOST_INTRUSIVE_AVL_SET_HPP