splay_set.hpp 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  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_SPLAY_SET_HPP
  13. #define BOOST_INTRUSIVE_SPLAY_SET_HPP
  14. #include <boost/intrusive/detail/config_begin.hpp>
  15. #include <boost/intrusive/intrusive_fwd.hpp>
  16. #include <boost/intrusive/splaytree.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 splay_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 splay_set_impl
  42. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  43. : public splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder>
  44. #endif
  45. {
  46. /// @cond
  47. typedef splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
  48. BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_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::splaytree::splaytree()
  77. splay_set_impl()
  78. : tree_type()
  79. {}
  80. //! @copydoc ::boost::intrusive::splaytree::splaytree(const key_compare &,const value_traits &)
  81. explicit splay_set_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
  82. : tree_type(cmp, v_traits)
  83. {}
  84. //! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
  85. template<class Iterator>
  86. splay_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::splaytree::splaytree(splaytree &&)
  92. splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
  93. : tree_type(BOOST_MOVE_BASE(tree_type, x))
  94. {}
  95. //! @copydoc ::boost::intrusive::splaytree::operator=(splaytree &&)
  96. splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
  97. { return static_cast<splay_set_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
  98. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  99. //! @copydoc ::boost::intrusive::splaytree::~splaytree()
  100. ~splay_set_impl();
  101. //! @copydoc ::boost::intrusive::splaytree::begin()
  102. iterator begin();
  103. //! @copydoc ::boost::intrusive::splaytree::begin()const
  104. const_iterator begin() const;
  105. //! @copydoc ::boost::intrusive::splaytree::cbegin()const
  106. const_iterator cbegin() const;
  107. //! @copydoc ::boost::intrusive::splaytree::end()
  108. iterator end();
  109. //! @copydoc ::boost::intrusive::splaytree::end()const
  110. const_iterator end() const;
  111. //! @copydoc ::boost::intrusive::splaytree::cend()const
  112. const_iterator cend() const;
  113. //! @copydoc ::boost::intrusive::splaytree::rbegin()
  114. reverse_iterator rbegin();
  115. //! @copydoc ::boost::intrusive::splaytree::rbegin()const
  116. const_reverse_iterator rbegin() const;
  117. //! @copydoc ::boost::intrusive::splaytree::crbegin()const
  118. const_reverse_iterator crbegin() const;
  119. //! @copydoc ::boost::intrusive::splaytree::rend()
  120. reverse_iterator rend();
  121. //! @copydoc ::boost::intrusive::splaytree::rend()const
  122. const_reverse_iterator rend() const;
  123. //! @copydoc ::boost::intrusive::splaytree::crend()const
  124. const_reverse_iterator crend() const;
  125. //! @copydoc ::boost::intrusive::splaytree::container_from_end_iterator(iterator)
  126. static splay_set_impl &container_from_end_iterator(iterator end_iterator);
  127. //! @copydoc ::boost::intrusive::splaytree::container_from_end_iterator(const_iterator)
  128. static const splay_set_impl &container_from_end_iterator(const_iterator end_iterator);
  129. //! @copydoc ::boost::intrusive::splaytree::container_from_iterator(iterator)
  130. static splay_set_impl &container_from_iterator(iterator it);
  131. //! @copydoc ::boost::intrusive::splaytree::container_from_iterator(const_iterator)
  132. static const splay_set_impl &container_from_iterator(const_iterator it);
  133. //! @copydoc ::boost::intrusive::splaytree::key_comp()const
  134. key_compare key_comp() const;
  135. //! @copydoc ::boost::intrusive::splaytree::value_comp()const
  136. value_compare value_comp() const;
  137. //! @copydoc ::boost::intrusive::splaytree::empty()const
  138. bool empty() const;
  139. //! @copydoc ::boost::intrusive::splaytree::size()const
  140. size_type size() const;
  141. //! @copydoc ::boost::intrusive::splaytree::swap
  142. void swap(splay_set_impl& other);
  143. //! @copydoc ::boost::intrusive::splaytree::clone_from(const splaytree&,Cloner,Disposer)
  144. template <class Cloner, class Disposer>
  145. void clone_from(const splay_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::splaytree::clone_from(splaytree&&,Cloner,Disposer)
  150. template <class Cloner, class Disposer>
  151. void clone_from(BOOST_RV_REF(splay_set_impl) src, Cloner cloner, Disposer disposer)
  152. { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
  153. //! @copydoc ::boost::intrusive::splaytree::insert_unique(reference)
  154. std::pair<iterator, bool> insert(reference value)
  155. { return tree_type::insert_unique(value); }
  156. //! @copydoc ::boost::intrusive::splaytree::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::rbtree::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::rbtree::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::splaytree::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::splaytree::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::splaytree::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::splaytree::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::splaytree::insert_before
  188. iterator insert_before(const_iterator pos, reference value);
  189. //! @copydoc ::boost::intrusive::splaytree::push_back
  190. void push_back(reference value);
  191. //! @copydoc ::boost::intrusive::splaytree::push_front
  192. void push_front(reference value);
  193. //! @copydoc ::boost::intrusive::splaytree::erase(const_iterator)
  194. iterator erase(const_iterator i);
  195. //! @copydoc ::boost::intrusive::splaytree::erase(const_iterator,const_iterator)
  196. iterator erase(const_iterator b, const_iterator e);
  197. //! @copydoc ::boost::intrusive::splaytree::erase(const key_type &)
  198. size_type erase(const key_type &key);
  199. //! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyTypeKeyCompare)
  200. template<class KeyType, class KeyTypeKeyCompare>
  201. size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
  202. //! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_iterator,Disposer)
  203. template<class Disposer>
  204. iterator erase_and_dispose(const_iterator i, Disposer disposer);
  205. //! @copydoc ::boost::intrusive::splaytree::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::splaytree::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::splaytree::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::splaytree::clear
  215. void clear();
  216. //! @copydoc ::boost::intrusive::splaytree::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::splaytree::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::splaytree::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::splaytree::count(const key_type &)const
  229. size_type count(const key_type &key) const;
  230. //! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyTypeKeyCompare)const
  231. template<class KeyType, class KeyTypeKeyCompare>
  232. size_type count(const KeyType& key, KeyTypeKeyCompare comp) const;
  233. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type &)
  234. iterator lower_bound(const key_type &key);
  235. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)
  236. template<class KeyType, class KeyTypeKeyCompare>
  237. iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
  238. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type &)const
  239. const_iterator lower_bound(const key_type &key) const;
  240. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
  241. template<class KeyType, class KeyTypeKeyCompare>
  242. const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  243. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type &)
  244. iterator upper_bound(const key_type &key);
  245. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)
  246. template<class KeyType, class KeyTypeKeyCompare>
  247. iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
  248. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type &)const
  249. const_iterator upper_bound(const key_type &key) const;
  250. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
  251. template<class KeyType, class KeyTypeKeyCompare>
  252. const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  253. //! @copydoc ::boost::intrusive::splaytree::find(const key_type &)
  254. iterator find(const key_type &key);
  255. //! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)
  256. template<class KeyType, class KeyTypeKeyCompare>
  257. iterator find(const KeyType& key, KeyTypeKeyCompare comp);
  258. //! @copydoc ::boost::intrusive::splaytree::find(const key_type &)const
  259. const_iterator find(const key_type &key) const;
  260. //! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)const
  261. template<class KeyType, class KeyTypeKeyCompare>
  262. const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
  263. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  264. //! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)
  265. std::pair<iterator,iterator> equal_range(const key_type &key)
  266. { return this->tree_type::lower_bound_range(key); }
  267. //! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)
  268. template<class KeyType, class KeyTypeKeyCompare>
  269. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp)
  270. { return this->tree_type::equal_range(key, comp); }
  271. //! @copydoc ::boost::intrusive::rbtree::equal_range(const key_type &)const
  272. std::pair<const_iterator, const_iterator>
  273. equal_range(const key_type &key) const
  274. { return this->tree_type::lower_bound_range(key); }
  275. //! @copydoc ::boost::intrusive::rbtree::equal_range(const KeyType&,KeyTypeKeyCompare)const
  276. template<class KeyType, class KeyTypeKeyCompare>
  277. std::pair<const_iterator, const_iterator>
  278. equal_range(const KeyType& key, KeyTypeKeyCompare comp) const
  279. { return this->tree_type::equal_range(key, comp); }
  280. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  281. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&,const key_type&,bool,bool)
  282. std::pair<iterator,iterator> bounded_range
  283. (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
  284. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
  285. template<class KeyType, class KeyTypeKeyCompare>
  286. std::pair<iterator,iterator> bounded_range
  287. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
  288. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&,const key_type&,bool,bool)const
  289. std::pair<const_iterator, const_iterator> bounded_range
  290. (const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
  291. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
  292. template<class KeyType, class KeyTypeKeyCompare>
  293. std::pair<const_iterator, const_iterator> bounded_range
  294. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
  295. //! @copydoc ::boost::intrusive::splaytree::s_iterator_to(reference)
  296. static iterator s_iterator_to(reference value);
  297. //! @copydoc ::boost::intrusive::splaytree::s_iterator_to(const_reference)
  298. static const_iterator s_iterator_to(const_reference value);
  299. //! @copydoc ::boost::intrusive::splaytree::iterator_to(reference)
  300. iterator iterator_to(reference value);
  301. //! @copydoc ::boost::intrusive::splaytree::iterator_to(const_reference)const
  302. const_iterator iterator_to(const_reference value) const;
  303. //! @copydoc ::boost::intrusive::splaytree::init_node(reference)
  304. static void init_node(reference value);
  305. //! @copydoc ::boost::intrusive::splaytree::unlink_leftmost_without_rebalance
  306. pointer unlink_leftmost_without_rebalance();
  307. //! @copydoc ::boost::intrusive::splaytree::replace_node
  308. void replace_node(iterator replace_this, reference with_this);
  309. //! @copydoc ::boost::intrusive::splaytree::remove_node
  310. void remove_node(reference value);
  311. //! @copydoc ::boost::intrusive::splaytree::splay_up(iterator)
  312. void splay_up(iterator i);
  313. //! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyTypeKeyCompare)
  314. template<class KeyType, class KeyTypeKeyCompare>
  315. iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp);
  316. //! @copydoc ::boost::intrusive::splaytree::splay_down(const key_type &key)
  317. iterator splay_down(const key_type &key);
  318. //! @copydoc ::boost::intrusive::splaytree::rebalance
  319. void rebalance();
  320. //! @copydoc ::boost::intrusive::splaytree::rebalance_subtree
  321. iterator rebalance_subtree(iterator root);
  322. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  323. };
  324. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  325. template<class T, class ...Options>
  326. bool operator!= (const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y);
  327. template<class T, class ...Options>
  328. bool operator>(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y);
  329. template<class T, class ...Options>
  330. bool operator<=(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y);
  331. template<class T, class ...Options>
  332. bool operator>=(const splay_set_impl<T, Options...> &x, const splay_set_impl<T, Options...> &y);
  333. template<class T, class ...Options>
  334. void swap(splay_set_impl<T, Options...> &x, splay_set_impl<T, Options...> &y);
  335. #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  336. //! Helper metafunction to define a \c splay_set that yields to the same type when the
  337. //! same options (either explicitly or implicitly) are used.
  338. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  339. template<class T, class ...Options>
  340. #else
  341. template<class T, class O1 = void, class O2 = void
  342. , class O3 = void, class O4 = void
  343. , class O5 = void, class O6 = void>
  344. #endif
  345. struct make_splay_set
  346. {
  347. /// @cond
  348. typedef typename pack_options
  349. < splaytree_defaults,
  350. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  351. O1, O2, O3, O4, O5, O6
  352. #else
  353. Options...
  354. #endif
  355. >::type packed_options;
  356. typedef typename detail::get_value_traits
  357. <T, typename packed_options::proto_value_traits>::type value_traits;
  358. typedef splay_set_impl
  359. < value_traits
  360. , typename packed_options::key_of_value
  361. , typename packed_options::compare
  362. , typename packed_options::size_type
  363. , packed_options::constant_time_size
  364. , typename packed_options::header_holder_type
  365. > implementation_defined;
  366. /// @endcond
  367. typedef implementation_defined type;
  368. };
  369. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  370. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  371. template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
  372. #else
  373. template<class T, class ...Options>
  374. #endif
  375. class splay_set
  376. : public make_splay_set<T,
  377. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  378. O1, O2, O3, O4, O5, O6
  379. #else
  380. Options...
  381. #endif
  382. >::type
  383. {
  384. typedef typename make_splay_set
  385. <T,
  386. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  387. O1, O2, O3, O4, O5, O6
  388. #else
  389. Options...
  390. #endif
  391. >::type Base;
  392. BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set)
  393. public:
  394. typedef typename Base::key_compare key_compare;
  395. typedef typename Base::value_traits value_traits;
  396. typedef typename Base::iterator iterator;
  397. typedef typename Base::const_iterator const_iterator;
  398. //Assert if passed value traits are compatible with the type
  399. BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
  400. splay_set()
  401. : Base()
  402. {}
  403. explicit splay_set( const key_compare &cmp, const value_traits &v_traits = value_traits())
  404. : Base(cmp, v_traits)
  405. {}
  406. template<class Iterator>
  407. splay_set( Iterator b, Iterator e
  408. , const key_compare &cmp = key_compare()
  409. , const value_traits &v_traits = value_traits())
  410. : Base(b, e, cmp, v_traits)
  411. {}
  412. splay_set(BOOST_RV_REF(splay_set) x)
  413. : Base(::boost::move(static_cast<Base&>(x)))
  414. {}
  415. splay_set& operator=(BOOST_RV_REF(splay_set) x)
  416. { return static_cast<splay_set &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
  417. template <class Cloner, class Disposer>
  418. void clone_from(const splay_set &src, Cloner cloner, Disposer disposer)
  419. { Base::clone_from(src, cloner, disposer); }
  420. template <class Cloner, class Disposer>
  421. void clone_from(BOOST_RV_REF(splay_set) src, Cloner cloner, Disposer disposer)
  422. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  423. static splay_set &container_from_end_iterator(iterator end_iterator)
  424. { return static_cast<splay_set &>(Base::container_from_end_iterator(end_iterator)); }
  425. static const splay_set &container_from_end_iterator(const_iterator end_iterator)
  426. { return static_cast<const splay_set &>(Base::container_from_end_iterator(end_iterator)); }
  427. static splay_set &container_from_iterator(iterator it)
  428. { return static_cast<splay_set &>(Base::container_from_iterator(it)); }
  429. static const splay_set &container_from_iterator(const_iterator it)
  430. { return static_cast<const splay_set &>(Base::container_from_iterator(it)); }
  431. };
  432. #endif
  433. //! The class template splay_multiset is an intrusive container, that mimics most of
  434. //! the interface of std::multiset as described in the C++ standard.
  435. //!
  436. //! The template parameter \c T is the type to be managed by the container.
  437. //! The user can specify additional options and if no options are provided
  438. //! default options are used.
  439. //!
  440. //! The container supports the following options:
  441. //! \c base_hook<>/member_hook<>/value_traits<>,
  442. //! \c constant_time_size<>, \c size_type<> and
  443. //! \c compare<>.
  444. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  445. template<class T, class ...Options>
  446. #else
  447. template<class ValueTraits, class VoidOrKeyOfValue, class Compare, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
  448. #endif
  449. class splay_multiset_impl
  450. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  451. : public splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder>
  452. #endif
  453. {
  454. /// @cond
  455. typedef splaytree_impl<ValueTraits, VoidOrKeyOfValue, Compare, SizeType, ConstantTimeSize, HeaderHolder> tree_type;
  456. BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset_impl)
  457. typedef tree_type implementation_defined;
  458. /// @endcond
  459. public:
  460. typedef typename implementation_defined::value_type value_type;
  461. typedef typename implementation_defined::key_type key_type;
  462. typedef typename implementation_defined::key_of_value key_of_value;
  463. typedef typename implementation_defined::value_traits value_traits;
  464. typedef typename implementation_defined::pointer pointer;
  465. typedef typename implementation_defined::const_pointer const_pointer;
  466. typedef typename implementation_defined::reference reference;
  467. typedef typename implementation_defined::const_reference const_reference;
  468. typedef typename implementation_defined::difference_type difference_type;
  469. typedef typename implementation_defined::size_type size_type;
  470. typedef typename implementation_defined::value_compare value_compare;
  471. typedef typename implementation_defined::key_compare key_compare;
  472. typedef typename implementation_defined::iterator iterator;
  473. typedef typename implementation_defined::const_iterator const_iterator;
  474. typedef typename implementation_defined::reverse_iterator reverse_iterator;
  475. typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
  476. typedef typename implementation_defined::insert_commit_data insert_commit_data;
  477. typedef typename implementation_defined::node_traits node_traits;
  478. typedef typename implementation_defined::node node;
  479. typedef typename implementation_defined::node_ptr node_ptr;
  480. typedef typename implementation_defined::const_node_ptr const_node_ptr;
  481. typedef typename implementation_defined::node_algorithms node_algorithms;
  482. static const bool constant_time_size = tree_type::constant_time_size;
  483. public:
  484. //! @copydoc ::boost::intrusive::splaytree::splaytree()
  485. splay_multiset_impl()
  486. : tree_type()
  487. {}
  488. //! @copydoc ::boost::intrusive::splaytree::splaytree(const key_compare &,const value_traits &)
  489. explicit splay_multiset_impl(const key_compare &cmp, const value_traits &v_traits = value_traits())
  490. : tree_type(cmp, v_traits)
  491. {}
  492. //! @copydoc ::boost::intrusive::splaytree::splaytree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
  493. template<class Iterator>
  494. splay_multiset_impl( Iterator b, Iterator e
  495. , const key_compare &cmp = key_compare()
  496. , const value_traits &v_traits = value_traits())
  497. : tree_type(false, b, e, cmp, v_traits)
  498. {}
  499. //! @copydoc ::boost::intrusive::splaytree::splaytree(splaytree &&)
  500. splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
  501. : tree_type(::boost::move(static_cast<tree_type&>(x)))
  502. {}
  503. //! @copydoc ::boost::intrusive::splaytree::operator=(splaytree &&)
  504. splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
  505. { return static_cast<splay_multiset_impl&>(tree_type::operator=(::boost::move(static_cast<tree_type&>(x)))); }
  506. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  507. //! @copydoc ::boost::intrusive::splaytree::~splaytree()
  508. ~splay_multiset_impl();
  509. //! @copydoc ::boost::intrusive::splaytree::begin()
  510. iterator begin();
  511. //! @copydoc ::boost::intrusive::splaytree::begin()const
  512. const_iterator begin() const;
  513. //! @copydoc ::boost::intrusive::splaytree::cbegin()const
  514. const_iterator cbegin() const;
  515. //! @copydoc ::boost::intrusive::splaytree::end()
  516. iterator end();
  517. //! @copydoc ::boost::intrusive::splaytree::end()const
  518. const_iterator end() const;
  519. //! @copydoc ::boost::intrusive::splaytree::cend()const
  520. const_iterator cend() const;
  521. //! @copydoc ::boost::intrusive::splaytree::rbegin()
  522. reverse_iterator rbegin();
  523. //! @copydoc ::boost::intrusive::splaytree::rbegin()const
  524. const_reverse_iterator rbegin() const;
  525. //! @copydoc ::boost::intrusive::splaytree::crbegin()const
  526. const_reverse_iterator crbegin() const;
  527. //! @copydoc ::boost::intrusive::splaytree::rend()
  528. reverse_iterator rend();
  529. //! @copydoc ::boost::intrusive::splaytree::rend()const
  530. const_reverse_iterator rend() const;
  531. //! @copydoc ::boost::intrusive::splaytree::crend()const
  532. const_reverse_iterator crend() const;
  533. //! @copydoc ::boost::intrusive::splaytree::container_from_end_iterator(iterator)
  534. static splay_multiset_impl &container_from_end_iterator(iterator end_iterator);
  535. //! @copydoc ::boost::intrusive::splaytree::container_from_end_iterator(const_iterator)
  536. static const splay_multiset_impl &container_from_end_iterator(const_iterator end_iterator);
  537. //! @copydoc ::boost::intrusive::splaytree::container_from_iterator(iterator)
  538. static splay_multiset_impl &container_from_iterator(iterator it);
  539. //! @copydoc ::boost::intrusive::splaytree::container_from_iterator(const_iterator)
  540. static const splay_multiset_impl &container_from_iterator(const_iterator it);
  541. //! @copydoc ::boost::intrusive::splaytree::key_comp()const
  542. key_compare key_comp() const;
  543. //! @copydoc ::boost::intrusive::splaytree::value_comp()const
  544. value_compare value_comp() const;
  545. //! @copydoc ::boost::intrusive::splaytree::empty()const
  546. bool empty() const;
  547. //! @copydoc ::boost::intrusive::splaytree::size()const
  548. size_type size() const;
  549. //! @copydoc ::boost::intrusive::splaytree::swap
  550. void swap(splay_multiset_impl& other);
  551. //! @copydoc ::boost::intrusive::splaytree::clone_from(const splaytree&,Cloner,Disposer)
  552. template <class Cloner, class Disposer>
  553. void clone_from(const splay_multiset_impl &src, Cloner cloner, Disposer disposer);
  554. #else
  555. using tree_type::clone_from;
  556. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  557. //! @copydoc ::boost::intrusive::splaytree::clone_from(splaytree&&,Cloner,Disposer)
  558. template <class Cloner, class Disposer>
  559. void clone_from(BOOST_RV_REF(splay_multiset_impl) src, Cloner cloner, Disposer disposer)
  560. { tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
  561. //! @copydoc ::boost::intrusive::splaytree::insert_equal(reference)
  562. iterator insert(reference value)
  563. { return tree_type::insert_equal(value); }
  564. //! @copydoc ::boost::intrusive::splaytree::insert_equal(const_iterator,reference)
  565. iterator insert(const_iterator hint, reference value)
  566. { return tree_type::insert_equal(hint, value); }
  567. //! @copydoc ::boost::intrusive::splaytree::insert_equal(Iterator,Iterator)
  568. template<class Iterator>
  569. void insert(Iterator b, Iterator e)
  570. { tree_type::insert_equal(b, e); }
  571. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  572. //! @copydoc ::boost::intrusive::splaytree::insert_before
  573. iterator insert_before(const_iterator pos, reference value);
  574. //! @copydoc ::boost::intrusive::splaytree::push_back
  575. void push_back(reference value);
  576. //! @copydoc ::boost::intrusive::splaytree::push_front
  577. void push_front(reference value);
  578. //! @copydoc ::boost::intrusive::splaytree::erase(const_iterator)
  579. iterator erase(const_iterator i);
  580. //! @copydoc ::boost::intrusive::splaytree::erase(const_iterator,const_iterator)
  581. iterator erase(const_iterator b, const_iterator e);
  582. //! @copydoc ::boost::intrusive::splaytree::erase(const key_type&)
  583. size_type erase(const key_type &key);
  584. //! @copydoc ::boost::intrusive::splaytree::erase(const KeyType&,KeyTypeKeyCompare)
  585. template<class KeyType, class KeyTypeKeyCompare>
  586. size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
  587. //! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_iterator,Disposer)
  588. template<class Disposer>
  589. iterator erase_and_dispose(const_iterator i, Disposer disposer);
  590. //! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const_iterator,const_iterator,Disposer)
  591. template<class Disposer>
  592. iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
  593. //! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const key_type&, Disposer)
  594. template<class Disposer>
  595. size_type erase_and_dispose(const key_type &key, Disposer disposer);
  596. //! @copydoc ::boost::intrusive::splaytree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
  597. template<class KeyType, class KeyTypeKeyCompare, class Disposer>
  598. size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
  599. //! @copydoc ::boost::intrusive::splaytree::clear
  600. void clear();
  601. //! @copydoc ::boost::intrusive::splaytree::clear_and_dispose
  602. template<class Disposer>
  603. void clear_and_dispose(Disposer disposer);
  604. //! @copydoc ::boost::intrusive::splaytree::count(const key_type&)
  605. size_type count(const key_type&);
  606. //! @copydoc ::boost::intrusive::splaytree::count(const KeyType&,KeyTypeKeyCompare)const
  607. template<class KeyType, class KeyTypeKeyCompare>
  608. size_type count(const KeyType& key, KeyTypeKeyCompare comp);
  609. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type&)
  610. iterator lower_bound(const key_type &key);
  611. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)
  612. template<class KeyType, class KeyTypeKeyCompare>
  613. iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp);
  614. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const key_type&)const
  615. const_iterator lower_bound(const key_type &key) const;
  616. //! @copydoc ::boost::intrusive::splaytree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
  617. template<class KeyType, class KeyTypeKeyCompare>
  618. const_iterator lower_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  619. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type&)
  620. iterator upper_bound(const key_type &key);
  621. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)
  622. template<class KeyType, class KeyTypeKeyCompare>
  623. iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp);
  624. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const key_type&)const
  625. const_iterator upper_bound(const key_type &key) const;
  626. //! @copydoc ::boost::intrusive::splaytree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
  627. template<class KeyType, class KeyTypeKeyCompare>
  628. const_iterator upper_bound(const KeyType& key, KeyTypeKeyCompare comp) const;
  629. //! @copydoc ::boost::intrusive::splaytree::find(const key_type&)
  630. iterator find(const key_type &key);
  631. //! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)
  632. template<class KeyType, class KeyTypeKeyCompare>
  633. iterator find(const KeyType& key, KeyTypeKeyCompare comp);
  634. //! @copydoc ::boost::intrusive::splaytree::find(const key_type&)const
  635. const_iterator find(const key_type &key) const;
  636. //! @copydoc ::boost::intrusive::splaytree::find(const KeyType&,KeyTypeKeyCompare)const
  637. template<class KeyType, class KeyTypeKeyCompare>
  638. const_iterator find(const KeyType& key, KeyTypeKeyCompare comp) const;
  639. //! @copydoc ::boost::intrusive::splaytree::equal_range(const key_type&)
  640. std::pair<iterator,iterator> equal_range(const key_type &key);
  641. //! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyTypeKeyCompare)
  642. template<class KeyType, class KeyTypeKeyCompare>
  643. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyTypeKeyCompare comp);
  644. //! @copydoc ::boost::intrusive::splaytree::equal_range(const key_type&)const
  645. std::pair<const_iterator, const_iterator>
  646. equal_range(const key_type &key) const;
  647. //! @copydoc ::boost::intrusive::splaytree::equal_range(const KeyType&,KeyTypeKeyCompare)const
  648. template<class KeyType, class KeyTypeKeyCompare>
  649. std::pair<const_iterator, const_iterator>
  650. equal_range(const KeyType& key, KeyTypeKeyCompare comp) const;
  651. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&, const key_type&,bool,bool)
  652. std::pair<iterator,iterator> bounded_range
  653. (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed);
  654. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
  655. template<class KeyType, class KeyTypeKeyCompare>
  656. std::pair<iterator,iterator> bounded_range
  657. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
  658. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const key_type&, const key_type&,bool,bool)const
  659. std::pair<const_iterator, const_iterator> bounded_range
  660. (const_reference lower_value, const_reference upper_value, bool left_closed, bool right_closed) const;
  661. //! @copydoc ::boost::intrusive::splaytree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
  662. template<class KeyType, class KeyTypeKeyCompare>
  663. std::pair<const_iterator, const_iterator> bounded_range
  664. (const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
  665. //! @copydoc ::boost::intrusive::splaytree::s_iterator_to(reference)
  666. static iterator s_iterator_to(reference value);
  667. //! @copydoc ::boost::intrusive::splaytree::s_iterator_to(const_reference)
  668. static const_iterator s_iterator_to(const_reference value);
  669. //! @copydoc ::boost::intrusive::splaytree::iterator_to(reference)
  670. iterator iterator_to(reference value);
  671. //! @copydoc ::boost::intrusive::splaytree::iterator_to(const_reference)const
  672. const_iterator iterator_to(const_reference value) const;
  673. //! @copydoc ::boost::intrusive::splaytree::init_node(reference)
  674. static void init_node(reference value);
  675. //! @copydoc ::boost::intrusive::splaytree::unlink_leftmost_without_rebalance
  676. pointer unlink_leftmost_without_rebalance();
  677. //! @copydoc ::boost::intrusive::splaytree::replace_node
  678. void replace_node(iterator replace_this, reference with_this);
  679. //! @copydoc ::boost::intrusive::splaytree::remove_node
  680. void remove_node(reference value);
  681. //! @copydoc ::boost::intrusive::splaytree::splay_up(iterator)
  682. void splay_up(iterator i);
  683. //! @copydoc ::boost::intrusive::splaytree::splay_down(const KeyType&,KeyTypeKeyCompare)
  684. template<class KeyType, class KeyTypeKeyCompare>
  685. iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp);
  686. //! @copydoc ::boost::intrusive::splaytree::splay_down(const key_type &key)
  687. iterator splay_down(const key_type &key);
  688. //! @copydoc ::boost::intrusive::splaytree::rebalance
  689. void rebalance();
  690. //! @copydoc ::boost::intrusive::splaytree::rebalance_subtree
  691. iterator rebalance_subtree(iterator root);
  692. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  693. };
  694. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  695. template<class T, class ...Options>
  696. bool operator!= (const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y);
  697. template<class T, class ...Options>
  698. bool operator>(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y);
  699. template<class T, class ...Options>
  700. bool operator<=(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y);
  701. template<class T, class ...Options>
  702. bool operator>=(const splay_multiset_impl<T, Options...> &x, const splay_multiset_impl<T, Options...> &y);
  703. template<class T, class ...Options>
  704. void swap(splay_multiset_impl<T, Options...> &x, splay_multiset_impl<T, Options...> &y);
  705. #endif //#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  706. //! Helper metafunction to define a \c splay_multiset that yields to the same type when the
  707. //! same options (either explicitly or implicitly) are used.
  708. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  709. template<class T, class ...Options>
  710. #else
  711. template<class T, class O1 = void, class O2 = void
  712. , class O3 = void, class O4 = void
  713. , class O5 = void, class O6 = void>
  714. #endif
  715. struct make_splay_multiset
  716. {
  717. /// @cond
  718. typedef typename pack_options
  719. < splaytree_defaults,
  720. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  721. O1, O2, O3, O4, O5, O6
  722. #else
  723. Options...
  724. #endif
  725. >::type packed_options;
  726. typedef typename detail::get_value_traits
  727. <T, typename packed_options::proto_value_traits>::type value_traits;
  728. typedef splay_multiset_impl
  729. < value_traits
  730. , typename packed_options::key_of_value
  731. , typename packed_options::compare
  732. , typename packed_options::size_type
  733. , packed_options::constant_time_size
  734. , typename packed_options::header_holder_type
  735. > implementation_defined;
  736. /// @endcond
  737. typedef implementation_defined type;
  738. };
  739. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  740. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  741. template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
  742. #else
  743. template<class T, class ...Options>
  744. #endif
  745. class splay_multiset
  746. : public make_splay_multiset<T,
  747. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  748. O1, O2, O3, O4, O5, O6
  749. #else
  750. Options...
  751. #endif
  752. >::type
  753. {
  754. typedef typename make_splay_multiset<T,
  755. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  756. O1, O2, O3, O4, O5, O6
  757. #else
  758. Options...
  759. #endif
  760. >::type Base;
  761. BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset)
  762. public:
  763. typedef typename Base::key_compare key_compare;
  764. typedef typename Base::value_traits value_traits;
  765. typedef typename Base::iterator iterator;
  766. typedef typename Base::const_iterator const_iterator;
  767. //Assert if passed value traits are compatible with the type
  768. BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
  769. splay_multiset()
  770. : Base()
  771. {}
  772. explicit splay_multiset( const key_compare &cmp, const value_traits &v_traits = value_traits())
  773. : Base(cmp, v_traits)
  774. {}
  775. template<class Iterator>
  776. splay_multiset( Iterator b, Iterator e
  777. , const key_compare &cmp = key_compare()
  778. , const value_traits &v_traits = value_traits())
  779. : Base(b, e, cmp, v_traits)
  780. {}
  781. splay_multiset(BOOST_RV_REF(splay_multiset) x)
  782. : Base(::boost::move(static_cast<Base&>(x)))
  783. {}
  784. splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x)
  785. { return static_cast<splay_multiset &>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); }
  786. template <class Cloner, class Disposer>
  787. void clone_from(const splay_multiset &src, Cloner cloner, Disposer disposer)
  788. { Base::clone_from(src, cloner, disposer); }
  789. template <class Cloner, class Disposer>
  790. void clone_from(BOOST_RV_REF(splay_multiset) src, Cloner cloner, Disposer disposer)
  791. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  792. static splay_multiset &container_from_end_iterator(iterator end_iterator)
  793. { return static_cast<splay_multiset &>(Base::container_from_end_iterator(end_iterator)); }
  794. static const splay_multiset &container_from_end_iterator(const_iterator end_iterator)
  795. { return static_cast<const splay_multiset &>(Base::container_from_end_iterator(end_iterator)); }
  796. static splay_multiset &container_from_iterator(iterator it)
  797. { return static_cast<splay_multiset &>(Base::container_from_iterator(it)); }
  798. static const splay_multiset &container_from_iterator(const_iterator it)
  799. { return static_cast<const splay_multiset &>(Base::container_from_iterator(it)); }
  800. };
  801. #endif
  802. } //namespace intrusive
  803. } //namespace boost
  804. #include <boost/intrusive/detail/config_end.hpp>
  805. #endif //BOOST_INTRUSIVE_SPLAY_SET_HPP