set.hpp 41 KB

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