unordered_set.hpp 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  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_UNORDERED_SET_HPP
  14. #define BOOST_INTRUSIVE_UNORDERED_SET_HPP
  15. #include <boost/intrusive/detail/config_begin.hpp>
  16. #include <boost/intrusive/intrusive_fwd.hpp>
  17. #include <boost/intrusive/hashtable.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 unordered_set is an intrusive container, that mimics most of
  26. //! the interface of std::tr1::unordered_set as described in the C++ TR1.
  27. //!
  28. //! unordered_set is a semi-intrusive container: each object to be stored in the
  29. //! container must contain a proper hook, but the container also needs
  30. //! additional auxiliary memory to work: unordered_set needs a pointer to an array
  31. //! of type `bucket_type` to be passed in the constructor. This bucket array must
  32. //! have at least the same lifetime as the container. This makes the use of
  33. //! unordered_set more complicated than purely intrusive containers.
  34. //! `bucket_type` is default-constructible, copyable and assignable
  35. //!
  36. //! The template parameter \c T is the type to be managed by the container.
  37. //! The user can specify additional options and if no options are provided
  38. //! default options are used.
  39. //!
  40. //! The container supports the following options:
  41. //! \c base_hook<>/member_hook<>/value_traits<>,
  42. //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
  43. //! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
  44. //!
  45. //! unordered_set only provides forward iterators but it provides 4 iterator types:
  46. //! iterator and const_iterator to navigate through the whole container and
  47. //! local_iterator and const_local_iterator to navigate through the values
  48. //! stored in a single bucket. Local iterators are faster and smaller.
  49. //!
  50. //! It's not recommended to use non constant-time size unordered_sets because several
  51. //! key functions, like "empty()", become non-constant time functions. Non
  52. //! constant-time size unordered_sets are mainly provided to support auto-unlink hooks.
  53. //!
  54. //! unordered_set, unlike std::unordered_set, does not make automatic rehashings nor
  55. //! offers functions related to a load factor. Rehashing can be explicitly requested
  56. //! and the user must provide a new bucket array that will be used from that moment.
  57. //!
  58. //! Since no automatic rehashing is done, iterators are never invalidated when
  59. //! inserting or erasing elements. Iterators are only invalidated when rehasing.
  60. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  61. template<class T, class ...Options>
  62. #else
  63. template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyHash, class VoidOrKeyEqual, class SizeType, class BucketTraits, std::size_t BoolFlags>
  64. #endif
  65. class unordered_set_impl
  66. : public hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags|hash_bool_flags::unique_keys_pos>
  67. {
  68. /// @cond
  69. private:
  70. typedef hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags|hash_bool_flags::unique_keys_pos> table_type;
  71. template<class Iterator, class MaybeConstThis, class KeyType, class KeyHasher, class KeyEqual>
  72. static std::pair<Iterator,Iterator> priv_equal_range(MaybeConstThis &c, const KeyType& key, KeyHasher hash_func, KeyEqual equal_func)
  73. {
  74. Iterator const it = c.find(key, hash_func, equal_func);
  75. std::pair<Iterator,Iterator> ret(it, it);
  76. if(it != c.end())
  77. ++ret.second;
  78. return ret;
  79. }
  80. //! This class is
  81. //! movable
  82. BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set_impl)
  83. typedef table_type implementation_defined;
  84. /// @endcond
  85. public:
  86. typedef typename implementation_defined::value_type value_type;
  87. typedef typename implementation_defined::key_type key_type;
  88. typedef typename implementation_defined::key_of_value key_of_value;
  89. typedef typename implementation_defined::value_traits value_traits;
  90. typedef typename implementation_defined::bucket_traits bucket_traits;
  91. typedef typename implementation_defined::pointer pointer;
  92. typedef typename implementation_defined::const_pointer const_pointer;
  93. typedef typename implementation_defined::reference reference;
  94. typedef typename implementation_defined::const_reference const_reference;
  95. typedef typename implementation_defined::difference_type difference_type;
  96. typedef typename implementation_defined::size_type size_type;
  97. typedef typename implementation_defined::key_equal key_equal;
  98. typedef typename implementation_defined::hasher hasher;
  99. typedef typename implementation_defined::bucket_type bucket_type;
  100. typedef typename implementation_defined::bucket_ptr bucket_ptr;
  101. typedef typename implementation_defined::iterator iterator;
  102. typedef typename implementation_defined::const_iterator const_iterator;
  103. typedef typename implementation_defined::insert_commit_data insert_commit_data;
  104. typedef typename implementation_defined::local_iterator local_iterator;
  105. typedef typename implementation_defined::const_local_iterator const_local_iterator;
  106. typedef typename implementation_defined::node_traits node_traits;
  107. typedef typename implementation_defined::node node;
  108. typedef typename implementation_defined::node_ptr node_ptr;
  109. typedef typename implementation_defined::const_node_ptr const_node_ptr;
  110. typedef typename implementation_defined::node_algorithms node_algorithms;
  111. public:
  112. //! @copydoc ::boost::intrusive::hashtable::hashtable(const bucket_traits &,const hasher &,const key_equal &,const value_traits &)
  113. explicit unordered_set_impl( const bucket_traits &b_traits
  114. , const hasher & hash_func = hasher()
  115. , const key_equal &equal_func = key_equal()
  116. , const value_traits &v_traits = value_traits())
  117. : table_type(b_traits, hash_func, equal_func, v_traits)
  118. {}
  119. //! @copydoc ::boost::intrusive::hashtable::hashtable(bool,Iterator,Iterator,const bucket_traits &,const hasher &,const key_equal &,const value_traits &)
  120. template<class Iterator>
  121. unordered_set_impl( Iterator b
  122. , Iterator e
  123. , const bucket_traits &b_traits
  124. , const hasher & hash_func = hasher()
  125. , const key_equal &equal_func = key_equal()
  126. , const value_traits &v_traits = value_traits())
  127. : table_type(true, b, e, b_traits, hash_func, equal_func, v_traits)
  128. {}
  129. //! @copydoc ::boost::intrusive::hashtable::hashtable(hashtable&&)
  130. unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
  131. : table_type(BOOST_MOVE_BASE(table_type, x))
  132. {}
  133. //! @copydoc ::boost::intrusive::hashtable::operator=(hashtable&&)
  134. unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
  135. { return static_cast<unordered_set_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); }
  136. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  137. //! @copydoc ::boost::intrusive::hashtable::~hashtable()
  138. ~unordered_set_impl();
  139. //! @copydoc ::boost::intrusive::hashtable::begin()
  140. iterator begin();
  141. //! @copydoc ::boost::intrusive::hashtable::begin()const
  142. const_iterator begin() const;
  143. //! @copydoc ::boost::intrusive::hashtable::cbegin()const
  144. const_iterator cbegin() const;
  145. //! @copydoc ::boost::intrusive::hashtable::end()
  146. iterator end();
  147. //! @copydoc ::boost::intrusive::hashtable::end()const
  148. const_iterator end() const;
  149. //! @copydoc ::boost::intrusive::hashtable::cend()const
  150. const_iterator cend() const;
  151. //! @copydoc ::boost::intrusive::hashtable::hash_function()const
  152. hasher hash_function() const;
  153. //! @copydoc ::boost::intrusive::hashtable::key_eq()const
  154. key_equal key_eq() const;
  155. //! @copydoc ::boost::intrusive::hashtable::empty()const
  156. bool empty() const;
  157. //! @copydoc ::boost::intrusive::hashtable::size()const
  158. size_type size() const;
  159. //! @copydoc ::boost::intrusive::hashtable::hashtable
  160. void swap(unordered_set_impl& other);
  161. //! @copydoc ::boost::intrusive::hashtable::clone_from(const hashtable&,Cloner,Disposer)
  162. template <class Cloner, class Disposer>
  163. void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer);
  164. #else
  165. using table_type::clone_from;
  166. #endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  167. //! @copydoc ::boost::intrusive::hashtable::clone_from(hashtable&&,Cloner,Disposer)
  168. template <class Cloner, class Disposer>
  169. void clone_from(BOOST_RV_REF(unordered_set_impl) src, Cloner cloner, Disposer disposer)
  170. { table_type::clone_from(BOOST_MOVE_BASE(table_type, src), cloner, disposer); }
  171. //! @copydoc ::boost::intrusive::hashtable::insert_unique(reference)
  172. std::pair<iterator, bool> insert(reference value)
  173. { return table_type::insert_unique(value); }
  174. //! @copydoc ::boost::intrusive::hashtable::insert_unique(Iterator,Iterator)
  175. template<class Iterator>
  176. void insert(Iterator b, Iterator e)
  177. { table_type::insert_unique(b, e); }
  178. //! @copydoc ::boost::intrusive::hashtable::insert_unique_check(const key_type&,insert_commit_data&)
  179. std::pair<iterator, bool> insert_check(const key_type &key, insert_commit_data &commit_data)
  180. { return table_type::insert_unique_check(key, commit_data); }
  181. //! @copydoc ::boost::intrusive::hashtable::insert_unique_check(const KeyType&,KeyHasher,KeyEqual,insert_commit_data&)
  182. template<class KeyType, class KeyHasher, class KeyEqual>
  183. std::pair<iterator, bool> insert_check
  184. (const KeyType &key, KeyHasher hasher, KeyEqual key_value_equal, insert_commit_data &commit_data)
  185. { return table_type::insert_unique_check(key, hasher, key_value_equal, commit_data); }
  186. //! @copydoc ::boost::intrusive::hashtable::insert_unique_commit
  187. iterator insert_commit(reference value, const insert_commit_data &commit_data)
  188. { return table_type::insert_unique_commit(value, commit_data); }
  189. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  190. //! @copydoc ::boost::intrusive::hashtable::erase(const_iterator)
  191. void erase(const_iterator i);
  192. //! @copydoc ::boost::intrusive::hashtable::erase(const_iterator,const_iterator)
  193. void erase(const_iterator b, const_iterator e);
  194. //! @copydoc ::boost::intrusive::hashtable::erase(const key_type &)
  195. size_type erase(const key_type &key);
  196. //! @copydoc ::boost::intrusive::hashtable::erase(const KeyType&,KeyHasher,KeyEqual)
  197. template<class KeyType, class KeyHasher, class KeyEqual>
  198. size_type erase(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
  199. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const_iterator,Disposer)
  200. template<class Disposer>
  201. BOOST_INTRUSIVE_DOC1ST(void
  202. , typename detail::disable_if_convertible<Disposer BOOST_INTRUSIVE_I const_iterator>::type)
  203. erase_and_dispose(const_iterator i, Disposer disposer);
  204. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const_iterator,const_iterator,Disposer)
  205. template<class Disposer>
  206. void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
  207. //! @copydoc ::boost::intrusive::hashtable::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::hashtable::erase_and_dispose(const KeyType&,KeyHasher,KeyEqual,Disposer)
  211. template<class KeyType, class KeyHasher, class KeyEqual, class Disposer>
  212. size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func, Disposer disposer);
  213. //! @copydoc ::boost::intrusive::hashtable::clear
  214. void clear();
  215. //! @copydoc ::boost::intrusive::hashtable::clear_and_dispose
  216. template<class Disposer>
  217. void clear_and_dispose(Disposer disposer);
  218. //! @copydoc ::boost::intrusive::hashtable::count(const key_type &)const
  219. size_type count(const key_type &key) const;
  220. //! @copydoc ::boost::intrusive::hashtable::count(const KeyType&,KeyHasher,KeyEqual)const
  221. template<class KeyType, class KeyHasher, class KeyEqual>
  222. size_type count(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
  223. //! @copydoc ::boost::intrusive::hashtable::find(const key_type &)
  224. iterator find(const key_type &key);
  225. //! @copydoc ::boost::intrusive::hashtable::find(const KeyType &,KeyHasher,KeyEqual)
  226. template<class KeyType, class KeyHasher, class KeyEqual>
  227. iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
  228. //! @copydoc ::boost::intrusive::hashtable::count(const key_type &)const
  229. const_iterator find(const key_type &key) const;
  230. //! @copydoc ::boost::intrusive::hashtable::find(const KeyType &,KeyHasher,KeyEqual)const
  231. template<class KeyType, class KeyHasher, class KeyEqual>
  232. const_iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
  233. #endif
  234. //! @copydoc ::boost::intrusive::hashtable::equal_range(const key_type&)
  235. std::pair<iterator,iterator> equal_range(const key_type &key)
  236. { return this->equal_range(key, this->hash_function(), this->key_eq()); }
  237. //! @copydoc ::boost::intrusive::hashtable::equal_range(const KeyType &,KeyHasher,KeyEqual)
  238. template<class KeyType, class KeyHasher, class KeyEqual>
  239. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func)
  240. { return this->priv_equal_range<iterator>(*this, key, hash_func, equal_func); }
  241. //! @copydoc ::boost::intrusive::hashtable::equal_range(const key_type&)const
  242. std::pair<const_iterator, const_iterator>
  243. equal_range(const key_type &key) const
  244. { return this->equal_range(key, this->hash_function(), this->key_eq()); }
  245. //! @copydoc ::boost::intrusive::hashtable::equal_range(const KeyType &,KeyHasher,KeyEqual)const
  246. template<class KeyType, class KeyHasher, class KeyEqual>
  247. std::pair<const_iterator, const_iterator>
  248. equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const
  249. { return this->priv_equal_range<const_iterator>(*this, key, hash_func, equal_func); }
  250. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  251. //! @copydoc ::boost::intrusive::hashtable::iterator_to(reference)
  252. iterator iterator_to(reference value);
  253. //! @copydoc ::boost::intrusive::hashtable::iterator_to(const_reference)const
  254. const_iterator iterator_to(const_reference value) const;
  255. //! @copydoc ::boost::intrusive::hashtable::s_local_iterator_to(reference)
  256. static local_iterator s_local_iterator_to(reference value);
  257. //! @copydoc ::boost::intrusive::hashtable::s_local_iterator_to(const_reference)
  258. static const_local_iterator s_local_iterator_to(const_reference value);
  259. //! @copydoc ::boost::intrusive::hashtable::local_iterator_to(reference)
  260. local_iterator local_iterator_to(reference value);
  261. //! @copydoc ::boost::intrusive::hashtable::local_iterator_to(const_reference)
  262. const_local_iterator local_iterator_to(const_reference value) const;
  263. //! @copydoc ::boost::intrusive::hashtable::bucket_count
  264. size_type bucket_count() const;
  265. //! @copydoc ::boost::intrusive::hashtable::bucket_size
  266. size_type bucket_size(size_type n) const;
  267. //! @copydoc ::boost::intrusive::hashtable::bucket(const key_type&)const
  268. size_type bucket(const key_type& k) const;
  269. //! @copydoc ::boost::intrusive::hashtable::bucket(const KeyType&,KeyHasher)const
  270. template<class KeyType, class KeyHasher>
  271. size_type bucket(const KeyType& k, KeyHasher hash_func) const;
  272. //! @copydoc ::boost::intrusive::hashtable::bucket_pointer
  273. bucket_ptr bucket_pointer() const;
  274. //! @copydoc ::boost::intrusive::hashtable::begin(size_type)
  275. local_iterator begin(size_type n);
  276. //! @copydoc ::boost::intrusive::hashtable::begin(size_type)const
  277. const_local_iterator begin(size_type n) const;
  278. //! @copydoc ::boost::intrusive::hashtable::cbegin(size_type)const
  279. const_local_iterator cbegin(size_type n) const;
  280. //! @copydoc ::boost::intrusive::hashtable::end(size_type)
  281. local_iterator end(size_type n);
  282. //! @copydoc ::boost::intrusive::hashtable::end(size_type)const
  283. const_local_iterator end(size_type n) const;
  284. //! @copydoc ::boost::intrusive::hashtable::cend(size_type)const
  285. const_local_iterator cend(size_type n) const;
  286. //! @copydoc ::boost::intrusive::hashtable::rehash(const bucket_traits &)
  287. void rehash(const bucket_traits &new_bucket_traits);
  288. //! @copydoc ::boost::intrusive::hashtable::incremental_rehash(bool)
  289. bool incremental_rehash(bool grow = true);
  290. //! @copydoc ::boost::intrusive::hashtable::incremental_rehash(const bucket_traits &)
  291. bool incremental_rehash(const bucket_traits &new_bucket_traits);
  292. //! @copydoc ::boost::intrusive::hashtable::split_count
  293. size_type split_count() const;
  294. //! @copydoc ::boost::intrusive::hashtable::suggested_upper_bucket_count
  295. static size_type suggested_upper_bucket_count(size_type n);
  296. //! @copydoc ::boost::intrusive::hashtable::suggested_lower_bucket_count
  297. static size_type suggested_lower_bucket_count(size_type n);
  298. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  299. friend bool operator==(const unordered_set_impl &x, const unordered_set_impl &y)
  300. {
  301. if(table_type::constant_time_size && x.size() != y.size()){
  302. return false;
  303. }
  304. //Find each element of x in y
  305. for (const_iterator ix = x.cbegin(), ex = x.cend(), ey = y.cend(); ix != ex; ++ix){
  306. const_iterator iy = y.find(key_of_value()(*ix));
  307. if (iy == ey || !(*ix == *iy))
  308. return false;
  309. }
  310. return true;
  311. }
  312. friend bool operator!=(const unordered_set_impl &x, const unordered_set_impl &y)
  313. { return !(x == y); }
  314. friend bool operator<(const unordered_set_impl &x, const unordered_set_impl &y)
  315. { return ::boost::intrusive::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
  316. friend bool operator>(const unordered_set_impl &x, const unordered_set_impl &y)
  317. { return y < x; }
  318. friend bool operator<=(const unordered_set_impl &x, const unordered_set_impl &y)
  319. { return !(y < x); }
  320. friend bool operator>=(const unordered_set_impl &x, const unordered_set_impl &y)
  321. { return !(x < y); }
  322. };
  323. //! Helper metafunction to define an \c unordered_set that yields to the same type when the
  324. //! same options (either explicitly or implicitly) are used.
  325. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  326. template<class T, class ...Options>
  327. #else
  328. template<class T, class O1 = void, class O2 = void
  329. , class O3 = void, class O4 = void
  330. , class O5 = void, class O6 = void
  331. , class O7 = void, class O8 = void
  332. , class O9 = void, class O10= void
  333. >
  334. #endif
  335. struct make_unordered_set
  336. {
  337. /// @cond
  338. typedef typename pack_options
  339. < hashtable_defaults,
  340. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  341. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  342. #else
  343. Options...
  344. #endif
  345. >::type packed_options;
  346. typedef typename detail::get_value_traits
  347. <T, typename packed_options::proto_value_traits>::type value_traits;
  348. typedef typename make_bucket_traits
  349. <T, true, packed_options>::type bucket_traits;
  350. typedef unordered_set_impl
  351. < value_traits
  352. , typename packed_options::key_of_value
  353. , typename packed_options::hash
  354. , typename packed_options::equal
  355. , typename packed_options::size_type
  356. , bucket_traits
  357. , (std::size_t(true)*hash_bool_flags::unique_keys_pos)
  358. | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos)
  359. | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos)
  360. | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos)
  361. | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos)
  362. | (std::size_t(packed_options::incremental)*hash_bool_flags::incremental_pos)
  363. > implementation_defined;
  364. /// @endcond
  365. typedef implementation_defined type;
  366. };
  367. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  368. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  369. template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
  370. #else
  371. template<class T, class ...Options>
  372. #endif
  373. class unordered_set
  374. : public make_unordered_set<T,
  375. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  376. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  377. #else
  378. Options...
  379. #endif
  380. >::type
  381. {
  382. typedef typename make_unordered_set
  383. <T,
  384. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  385. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  386. #else
  387. Options...
  388. #endif
  389. >::type Base;
  390. //Assert if passed value traits are compatible with the type
  391. BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
  392. BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set)
  393. public:
  394. typedef typename Base::value_traits value_traits;
  395. typedef typename Base::bucket_traits bucket_traits;
  396. typedef typename Base::iterator iterator;
  397. typedef typename Base::const_iterator const_iterator;
  398. typedef typename Base::bucket_ptr bucket_ptr;
  399. typedef typename Base::size_type size_type;
  400. typedef typename Base::hasher hasher;
  401. typedef typename Base::key_equal key_equal;
  402. explicit unordered_set ( const bucket_traits &b_traits
  403. , const hasher & hash_func = hasher()
  404. , const key_equal &equal_func = key_equal()
  405. , const value_traits &v_traits = value_traits())
  406. : Base(b_traits, hash_func, equal_func, v_traits)
  407. {}
  408. template<class Iterator>
  409. unordered_set ( Iterator b
  410. , Iterator e
  411. , const bucket_traits &b_traits
  412. , const hasher & hash_func = hasher()
  413. , const key_equal &equal_func = key_equal()
  414. , const value_traits &v_traits = value_traits())
  415. : Base(b, e, b_traits, hash_func, equal_func, v_traits)
  416. {}
  417. unordered_set(BOOST_RV_REF(unordered_set) x)
  418. : Base(BOOST_MOVE_BASE(Base, x))
  419. {}
  420. unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
  421. { return static_cast<unordered_set&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
  422. template <class Cloner, class Disposer>
  423. void clone_from(const unordered_set &src, Cloner cloner, Disposer disposer)
  424. { Base::clone_from(src, cloner, disposer); }
  425. template <class Cloner, class Disposer>
  426. void clone_from(BOOST_RV_REF(unordered_set) src, Cloner cloner, Disposer disposer)
  427. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  428. };
  429. #endif
  430. //! The class template unordered_multiset is an intrusive container, that mimics most of
  431. //! the interface of std::tr1::unordered_multiset as described in the C++ TR1.
  432. //!
  433. //! unordered_multiset is a semi-intrusive container: each object to be stored in the
  434. //! container must contain a proper hook, but the container also needs
  435. //! additional auxiliary memory to work: unordered_multiset needs a pointer to an array
  436. //! of type `bucket_type` to be passed in the constructor. This bucket array must
  437. //! have at least the same lifetime as the container. This makes the use of
  438. //! unordered_multiset more complicated than purely intrusive containers.
  439. //! `bucket_type` is default-constructible, copyable and assignable
  440. //!
  441. //! The template parameter \c T is the type to be managed by the container.
  442. //! The user can specify additional options and if no options are provided
  443. //! default options are used.
  444. //!
  445. //! The container supports the following options:
  446. //! \c base_hook<>/member_hook<>/value_traits<>,
  447. //! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
  448. //! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
  449. //!
  450. //! unordered_multiset only provides forward iterators but it provides 4 iterator types:
  451. //! iterator and const_iterator to navigate through the whole container and
  452. //! local_iterator and const_local_iterator to navigate through the values
  453. //! stored in a single bucket. Local iterators are faster and smaller.
  454. //!
  455. //! It's not recommended to use non constant-time size unordered_multisets because several
  456. //! key functions, like "empty()", become non-constant time functions. Non
  457. //! constant-time size unordered_multisets are mainly provided to support auto-unlink hooks.
  458. //!
  459. //! unordered_multiset, unlike std::unordered_set, does not make automatic rehashings nor
  460. //! offers functions related to a load factor. Rehashing can be explicitly requested
  461. //! and the user must provide a new bucket array that will be used from that moment.
  462. //!
  463. //! Since no automatic rehashing is done, iterators are never invalidated when
  464. //! inserting or erasing elements. Iterators are only invalidated when rehasing.
  465. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
  466. template<class T, class ...Options>
  467. #else
  468. template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyHash, class VoidOrKeyEqual, class SizeType, class BucketTraits, std::size_t BoolFlags>
  469. #endif
  470. class unordered_multiset_impl
  471. : public hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags>
  472. {
  473. /// @cond
  474. private:
  475. typedef hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags> table_type;
  476. /// @endcond
  477. //Movable
  478. BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset_impl)
  479. typedef table_type implementation_defined;
  480. public:
  481. typedef typename implementation_defined::value_type value_type;
  482. typedef typename implementation_defined::key_type key_type;
  483. typedef typename implementation_defined::value_traits value_traits;
  484. typedef typename implementation_defined::bucket_traits bucket_traits;
  485. typedef typename implementation_defined::pointer pointer;
  486. typedef typename implementation_defined::const_pointer const_pointer;
  487. typedef typename implementation_defined::reference reference;
  488. typedef typename implementation_defined::const_reference const_reference;
  489. typedef typename implementation_defined::difference_type difference_type;
  490. typedef typename implementation_defined::size_type size_type;
  491. typedef typename implementation_defined::key_equal key_equal;
  492. typedef typename implementation_defined::hasher hasher;
  493. typedef typename implementation_defined::bucket_type bucket_type;
  494. typedef typename implementation_defined::bucket_ptr bucket_ptr;
  495. typedef typename implementation_defined::iterator iterator;
  496. typedef typename implementation_defined::const_iterator const_iterator;
  497. typedef typename implementation_defined::insert_commit_data insert_commit_data;
  498. typedef typename implementation_defined::local_iterator local_iterator;
  499. typedef typename implementation_defined::const_local_iterator const_local_iterator;
  500. typedef typename implementation_defined::node_traits node_traits;
  501. typedef typename implementation_defined::node node;
  502. typedef typename implementation_defined::node_ptr node_ptr;
  503. typedef typename implementation_defined::const_node_ptr const_node_ptr;
  504. typedef typename implementation_defined::node_algorithms node_algorithms;
  505. public:
  506. //! @copydoc ::boost::intrusive::hashtable::hashtable(const bucket_traits &,const hasher &,const key_equal &,const value_traits &)
  507. explicit unordered_multiset_impl ( const bucket_traits &b_traits
  508. , const hasher & hash_func = hasher()
  509. , const key_equal &equal_func = key_equal()
  510. , const value_traits &v_traits = value_traits())
  511. : table_type(b_traits, hash_func, equal_func, v_traits)
  512. {}
  513. //! @copydoc ::boost::intrusive::hashtable::hashtable(bool,Iterator,Iterator,const bucket_traits &,const hasher &,const key_equal &,const value_traits &)
  514. template<class Iterator>
  515. unordered_multiset_impl ( Iterator b
  516. , Iterator e
  517. , const bucket_traits &b_traits
  518. , const hasher & hash_func = hasher()
  519. , const key_equal &equal_func = key_equal()
  520. , const value_traits &v_traits = value_traits())
  521. : table_type(false, b, e, b_traits, hash_func, equal_func, v_traits)
  522. {}
  523. //! <b>Effects</b>: to-do
  524. //!
  525. unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
  526. : table_type(BOOST_MOVE_BASE(table_type, x))
  527. {}
  528. //! <b>Effects</b>: to-do
  529. //!
  530. unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
  531. { return static_cast<unordered_multiset_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); }
  532. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  533. //! @copydoc ::boost::intrusive::hashtable::~hashtable()
  534. ~unordered_multiset_impl();
  535. //! @copydoc ::boost::intrusive::hashtable::begin()
  536. iterator begin();
  537. //! @copydoc ::boost::intrusive::hashtable::begin()const
  538. const_iterator begin() const;
  539. //! @copydoc ::boost::intrusive::hashtable::cbegin()const
  540. const_iterator cbegin() const;
  541. //! @copydoc ::boost::intrusive::hashtable::end()
  542. iterator end();
  543. //! @copydoc ::boost::intrusive::hashtable::end()const
  544. const_iterator end() const;
  545. //! @copydoc ::boost::intrusive::hashtable::cend()const
  546. const_iterator cend() const;
  547. //! @copydoc ::boost::intrusive::hashtable::hash_function()const
  548. hasher hash_function() const;
  549. //! @copydoc ::boost::intrusive::hashtable::key_eq()const
  550. key_equal key_eq() const;
  551. //! @copydoc ::boost::intrusive::hashtable::empty()const
  552. bool empty() const;
  553. //! @copydoc ::boost::intrusive::hashtable::size()const
  554. size_type size() const;
  555. //! @copydoc ::boost::intrusive::hashtable::hashtable
  556. void swap(unordered_multiset_impl& other);
  557. //! @copydoc ::boost::intrusive::hashtable::clone_from(const hashtable&,Cloner,Disposer)
  558. template <class Cloner, class Disposer>
  559. void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer);
  560. #else
  561. using table_type::clone_from;
  562. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  563. //! @copydoc ::boost::intrusive::hashtable::clone_from(hashtable&&,Cloner,Disposer)
  564. template <class Cloner, class Disposer>
  565. void clone_from(BOOST_RV_REF(unordered_multiset_impl) src, Cloner cloner, Disposer disposer)
  566. { table_type::clone_from(BOOST_MOVE_BASE(table_type, src), cloner, disposer); }
  567. //! @copydoc ::boost::intrusive::hashtable::insert_equal(reference)
  568. iterator insert(reference value)
  569. { return table_type::insert_equal(value); }
  570. //! @copydoc ::boost::intrusive::hashtable::insert_equal(Iterator,Iterator)
  571. template<class Iterator>
  572. void insert(Iterator b, Iterator e)
  573. { table_type::insert_equal(b, e); }
  574. #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  575. //! @copydoc ::boost::intrusive::hashtable::erase(const_iterator)
  576. void erase(const_iterator i);
  577. //! @copydoc ::boost::intrusive::hashtable::erase(const_iterator,const_iterator)
  578. void erase(const_iterator b, const_iterator e);
  579. //! @copydoc ::boost::intrusive::hashtable::erase(const key_type &)
  580. size_type erase(const key_type &key);
  581. //! @copydoc ::boost::intrusive::hashtable::erase(const KeyType&,KeyHasher,KeyEqual)
  582. template<class KeyType, class KeyHasher, class KeyEqual>
  583. size_type erase(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
  584. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const_iterator,Disposer)
  585. template<class Disposer>
  586. BOOST_INTRUSIVE_DOC1ST(void
  587. , typename detail::disable_if_convertible<Disposer BOOST_INTRUSIVE_I const_iterator>::type)
  588. erase_and_dispose(const_iterator i, Disposer disposer);
  589. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const_iterator,const_iterator,Disposer)
  590. template<class Disposer>
  591. void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
  592. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const key_type &,Disposer)
  593. template<class Disposer>
  594. size_type erase_and_dispose(const key_type &key, Disposer disposer);
  595. //! @copydoc ::boost::intrusive::hashtable::erase_and_dispose(const KeyType&,KeyHasher,KeyEqual,Disposer)
  596. template<class KeyType, class KeyHasher, class KeyEqual, class Disposer>
  597. size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func, Disposer disposer);
  598. //! @copydoc ::boost::intrusive::hashtable::clear
  599. void clear();
  600. //! @copydoc ::boost::intrusive::hashtable::clear_and_dispose
  601. template<class Disposer>
  602. void clear_and_dispose(Disposer disposer);
  603. //! @copydoc ::boost::intrusive::hashtable::count(const key_type &)const
  604. size_type count(const key_type &key) const;
  605. //! @copydoc ::boost::intrusive::hashtable::count(const KeyType&,KeyHasher,KeyEqual)const
  606. template<class KeyType, class KeyHasher, class KeyEqual>
  607. size_type count(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
  608. //! @copydoc ::boost::intrusive::hashtable::find(const key_type &)
  609. iterator find(const key_type &key);
  610. //! @copydoc ::boost::intrusive::hashtable::find(const KeyType &,KeyHasher,KeyEqual)
  611. template<class KeyType, class KeyHasher, class KeyEqual>
  612. iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
  613. //! @copydoc ::boost::intrusive::hashtable::count(const key_type &)const
  614. const_iterator find(const key_type &key) const;
  615. //! @copydoc ::boost::intrusive::hashtable::find(const KeyType &,KeyHasher,KeyEqual)const
  616. template<class KeyType, class KeyHasher, class KeyEqual>
  617. const_iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
  618. //! @copydoc ::boost::intrusive::hashtable::equal_range(const key_type&)
  619. std::pair<iterator,iterator> equal_range(const key_type &key);
  620. //! @copydoc ::boost::intrusive::hashtable::equal_range(const KeyType &,KeyHasher,KeyEqual)
  621. template<class KeyType, class KeyHasher, class KeyEqual>
  622. std::pair<iterator,iterator> equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
  623. //! @copydoc ::boost::intrusive::hashtable::equal_range(const key_type&)const
  624. std::pair<const_iterator, const_iterator>
  625. equal_range(const key_type &key) const;
  626. //! @copydoc ::boost::intrusive::hashtable::equal_range(const KeyType &,KeyHasher,KeyEqual)const
  627. template<class KeyType, class KeyHasher, class KeyEqual>
  628. std::pair<const_iterator, const_iterator>
  629. equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
  630. //! @copydoc ::boost::intrusive::hashtable::iterator_to(reference)
  631. iterator iterator_to(reference value);
  632. //! @copydoc ::boost::intrusive::hashtable::iterator_to(const_reference)const
  633. const_iterator iterator_to(const_reference value) const;
  634. //! @copydoc ::boost::intrusive::hashtable::s_local_iterator_to(reference)
  635. static local_iterator s_local_iterator_to(reference value);
  636. //! @copydoc ::boost::intrusive::hashtable::s_local_iterator_to(const_reference)
  637. static const_local_iterator s_local_iterator_to(const_reference value);
  638. //! @copydoc ::boost::intrusive::hashtable::local_iterator_to(reference)
  639. local_iterator local_iterator_to(reference value);
  640. //! @copydoc ::boost::intrusive::hashtable::local_iterator_to(const_reference)
  641. const_local_iterator local_iterator_to(const_reference value) const;
  642. //! @copydoc ::boost::intrusive::hashtable::bucket_count
  643. size_type bucket_count() const;
  644. //! @copydoc ::boost::intrusive::hashtable::bucket_size
  645. size_type bucket_size(size_type n) const;
  646. //! @copydoc ::boost::intrusive::hashtable::bucket(const key_type&)const
  647. size_type bucket(const key_type& k) const;
  648. //! @copydoc ::boost::intrusive::hashtable::bucket(const KeyType&,KeyHasher)const
  649. template<class KeyType, class KeyHasher>
  650. size_type bucket(const KeyType& k, KeyHasher hash_func) const;
  651. //! @copydoc ::boost::intrusive::hashtable::bucket_pointer
  652. bucket_ptr bucket_pointer() const;
  653. //! @copydoc ::boost::intrusive::hashtable::begin(size_type)
  654. local_iterator begin(size_type n);
  655. //! @copydoc ::boost::intrusive::hashtable::begin(size_type)const
  656. const_local_iterator begin(size_type n) const;
  657. //! @copydoc ::boost::intrusive::hashtable::cbegin(size_type)const
  658. const_local_iterator cbegin(size_type n) const;
  659. //! @copydoc ::boost::intrusive::hashtable::end(size_type)
  660. local_iterator end(size_type n);
  661. //! @copydoc ::boost::intrusive::hashtable::end(size_type)const
  662. const_local_iterator end(size_type n) const;
  663. //! @copydoc ::boost::intrusive::hashtable::cend(size_type)const
  664. const_local_iterator cend(size_type n) const;
  665. //! @copydoc ::boost::intrusive::hashtable::rehash(const bucket_traits &)
  666. void rehash(const bucket_traits &new_bucket_traits);
  667. //! @copydoc ::boost::intrusive::hashtable::incremental_rehash(bool)
  668. bool incremental_rehash(bool grow = true);
  669. //! @copydoc ::boost::intrusive::hashtable::incremental_rehash(const bucket_traits &)
  670. bool incremental_rehash(const bucket_traits &new_bucket_traits);
  671. //! @copydoc ::boost::intrusive::hashtable::split_count
  672. size_type split_count() const;
  673. //! @copydoc ::boost::intrusive::hashtable::suggested_upper_bucket_count
  674. static size_type suggested_upper_bucket_count(size_type n);
  675. //! @copydoc ::boost::intrusive::hashtable::suggested_lower_bucket_count
  676. static size_type suggested_lower_bucket_count(size_type n);
  677. #endif // #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  678. };
  679. //! Helper metafunction to define an \c unordered_multiset that yields to the same type when the
  680. //! same options (either explicitly or implicitly) are used.
  681. #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  682. template<class T, class ...Options>
  683. #else
  684. template<class T, class O1 = void, class O2 = void
  685. , class O3 = void, class O4 = void
  686. , class O5 = void, class O6 = void
  687. , class O7 = void, class O8 = void
  688. , class O9 = void, class O10= void
  689. >
  690. #endif
  691. struct make_unordered_multiset
  692. {
  693. /// @cond
  694. typedef typename pack_options
  695. < hashtable_defaults,
  696. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  697. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  698. #else
  699. Options...
  700. #endif
  701. >::type packed_options;
  702. typedef typename detail::get_value_traits
  703. <T, typename packed_options::proto_value_traits>::type value_traits;
  704. typedef typename make_bucket_traits
  705. <T, true, packed_options>::type bucket_traits;
  706. typedef unordered_multiset_impl
  707. < value_traits
  708. , typename packed_options::key_of_value
  709. , typename packed_options::hash
  710. , typename packed_options::equal
  711. , typename packed_options::size_type
  712. , bucket_traits
  713. , (std::size_t(false)*hash_bool_flags::unique_keys_pos)
  714. | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos)
  715. | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos)
  716. | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos)
  717. | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos)
  718. | (std::size_t(packed_options::incremental)*hash_bool_flags::incremental_pos)
  719. > implementation_defined;
  720. /// @endcond
  721. typedef implementation_defined type;
  722. };
  723. #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
  724. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  725. template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
  726. #else
  727. template<class T, class ...Options>
  728. #endif
  729. class unordered_multiset
  730. : public make_unordered_multiset<T,
  731. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  732. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  733. #else
  734. Options...
  735. #endif
  736. >::type
  737. {
  738. typedef typename make_unordered_multiset
  739. <T,
  740. #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
  741. O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
  742. #else
  743. Options...
  744. #endif
  745. >::type Base;
  746. //Assert if passed value traits are compatible with the type
  747. BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
  748. BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset)
  749. public:
  750. typedef typename Base::value_traits value_traits;
  751. typedef typename Base::bucket_traits bucket_traits;
  752. typedef typename Base::iterator iterator;
  753. typedef typename Base::const_iterator const_iterator;
  754. typedef typename Base::bucket_ptr bucket_ptr;
  755. typedef typename Base::size_type size_type;
  756. typedef typename Base::hasher hasher;
  757. typedef typename Base::key_equal key_equal;
  758. explicit unordered_multiset( const bucket_traits &b_traits
  759. , const hasher & hash_func = hasher()
  760. , const key_equal &equal_func = key_equal()
  761. , const value_traits &v_traits = value_traits())
  762. : Base(b_traits, hash_func, equal_func, v_traits)
  763. {}
  764. template<class Iterator>
  765. unordered_multiset( Iterator b
  766. , Iterator e
  767. , const bucket_traits &b_traits
  768. , const hasher & hash_func = hasher()
  769. , const key_equal &equal_func = key_equal()
  770. , const value_traits &v_traits = value_traits())
  771. : Base(b, e, b_traits, hash_func, equal_func, v_traits)
  772. {}
  773. unordered_multiset(BOOST_RV_REF(unordered_multiset) x)
  774. : Base(BOOST_MOVE_BASE(Base, x))
  775. {}
  776. unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
  777. { return static_cast<unordered_multiset&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
  778. template <class Cloner, class Disposer>
  779. void clone_from(const unordered_multiset &src, Cloner cloner, Disposer disposer)
  780. { Base::clone_from(src, cloner, disposer); }
  781. template <class Cloner, class Disposer>
  782. void clone_from(BOOST_RV_REF(unordered_multiset) src, Cloner cloner, Disposer disposer)
  783. { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
  784. };
  785. #endif
  786. } //namespace intrusive
  787. } //namespace boost
  788. #include <boost/intrusive/detail/config_end.hpp>
  789. #endif //BOOST_INTRUSIVE_UNORDERED_SET_HPP