bs_set.hpp 41 KB

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