123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994 |
- #ifndef BOOST_INTRUSIVE_UNORDERED_SET_HPP
- #define BOOST_INTRUSIVE_UNORDERED_SET_HPP
- #include <boost/intrusive/detail/config_begin.hpp>
- #include <boost/intrusive/intrusive_fwd.hpp>
- #include <boost/intrusive/hashtable.hpp>
- #include <boost/move/utility_core.hpp>
- #include <boost/static_assert.hpp>
- #if defined(BOOST_HAS_PRAGMA_ONCE)
- # pragma once
- #endif
- namespace boost {
- namespace intrusive {
- #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
- template<class T, class ...Options>
- #else
- template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyHash, class VoidOrKeyEqual, class SizeType, class BucketTraits, std::size_t BoolFlags>
- #endif
- class unordered_set_impl
- : public hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags|hash_bool_flags::unique_keys_pos>
- {
-
- private:
- typedef hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags|hash_bool_flags::unique_keys_pos> table_type;
- template<class Iterator, class MaybeConstThis, class KeyType, class KeyHasher, class KeyEqual>
- static std::pair<Iterator,Iterator> priv_equal_range(MaybeConstThis &c, const KeyType& key, KeyHasher hash_func, KeyEqual equal_func)
- {
- Iterator const it = c.find(key, hash_func, equal_func);
- std::pair<Iterator,Iterator> ret(it, it);
- if(it != c.end())
- ++ret.second;
- return ret;
- }
-
-
- BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set_impl)
- typedef table_type implementation_defined;
-
- public:
- typedef typename implementation_defined::value_type value_type;
- typedef typename implementation_defined::key_type key_type;
- typedef typename implementation_defined::key_of_value key_of_value;
- typedef typename implementation_defined::value_traits value_traits;
- typedef typename implementation_defined::bucket_traits bucket_traits;
- typedef typename implementation_defined::pointer pointer;
- typedef typename implementation_defined::const_pointer const_pointer;
- typedef typename implementation_defined::reference reference;
- typedef typename implementation_defined::const_reference const_reference;
- typedef typename implementation_defined::difference_type difference_type;
- typedef typename implementation_defined::size_type size_type;
- typedef typename implementation_defined::key_equal key_equal;
- typedef typename implementation_defined::hasher hasher;
- typedef typename implementation_defined::bucket_type bucket_type;
- typedef typename implementation_defined::bucket_ptr bucket_ptr;
- typedef typename implementation_defined::iterator iterator;
- typedef typename implementation_defined::const_iterator const_iterator;
- typedef typename implementation_defined::insert_commit_data insert_commit_data;
- typedef typename implementation_defined::local_iterator local_iterator;
- typedef typename implementation_defined::const_local_iterator const_local_iterator;
- typedef typename implementation_defined::node_traits node_traits;
- typedef typename implementation_defined::node node;
- typedef typename implementation_defined::node_ptr node_ptr;
- typedef typename implementation_defined::const_node_ptr const_node_ptr;
- typedef typename implementation_defined::node_algorithms node_algorithms;
- public:
-
- BOOST_INTRUSIVE_FORCEINLINE explicit unordered_set_impl( const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : table_type(b_traits, hash_func, equal_func, v_traits)
- {}
-
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE unordered_set_impl( Iterator b
- , Iterator e
- , const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : table_type(true, b, e, b_traits, hash_func, equal_func, v_traits)
- {}
-
- BOOST_INTRUSIVE_FORCEINLINE unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
- : table_type(BOOST_MOVE_BASE(table_type, x))
- {}
-
- BOOST_INTRUSIVE_FORCEINLINE unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
- { return static_cast<unordered_set_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); }
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-
- ~unordered_set_impl();
-
- iterator begin();
-
- const_iterator begin() const;
-
- const_iterator cbegin() const;
-
- iterator end();
-
- const_iterator end() const;
-
- const_iterator cend() const;
-
- hasher hash_function() const;
-
- key_equal key_eq() const;
-
- bool empty() const;
-
- size_type size() const;
-
- void swap(unordered_set_impl& other);
-
- template <class Cloner, class Disposer>
- void clone_from(const unordered_set_impl &src, Cloner cloner, Disposer disposer);
- #else
- using table_type::clone_from;
- #endif
-
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(unordered_set_impl) src, Cloner cloner, Disposer disposer)
- { table_type::clone_from(BOOST_MOVE_BASE(table_type, src), cloner, disposer); }
-
- BOOST_INTRUSIVE_FORCEINLINE std::pair<iterator, bool> insert(reference value)
- { return table_type::insert_unique(value); }
-
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE void insert(Iterator b, Iterator e)
- { table_type::insert_unique(b, e); }
-
- BOOST_INTRUSIVE_FORCEINLINE std::pair<iterator, bool> insert_check(const key_type &key, insert_commit_data &commit_data)
- { return table_type::insert_unique_check(key, commit_data); }
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- BOOST_INTRUSIVE_FORCEINLINE std::pair<iterator, bool> insert_check
- (const KeyType &key, KeyHasher hasher, KeyEqual key_value_equal, insert_commit_data &commit_data)
- { return table_type::insert_unique_check(key, hasher, key_value_equal, commit_data); }
-
- BOOST_INTRUSIVE_FORCEINLINE iterator insert_commit(reference value, const insert_commit_data &commit_data)
- { return table_type::insert_unique_commit(value, commit_data); }
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-
- void erase(const_iterator i);
-
- void erase(const_iterator b, const_iterator e);
-
- size_type erase(const key_type &key);
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- size_type erase(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
-
- template<class Disposer>
- BOOST_INTRUSIVE_DOC1ST(void
- , typename detail::disable_if_convertible<Disposer BOOST_INTRUSIVE_I const_iterator>::type)
- erase_and_dispose(const_iterator i, Disposer disposer);
-
- template<class Disposer>
- void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
-
- template<class Disposer>
- size_type erase_and_dispose(const key_type &key, Disposer disposer);
-
- template<class KeyType, class KeyHasher, class KeyEqual, class Disposer>
- size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func, Disposer disposer);
-
- void clear();
-
- template<class Disposer>
- void clear_and_dispose(Disposer disposer);
-
- size_type count(const key_type &key) const;
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- size_type count(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
-
- iterator find(const key_type &key);
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
-
- const_iterator find(const key_type &key) const;
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- const_iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
- #endif
-
- std::pair<iterator,iterator> equal_range(const key_type &key)
- { return this->equal_range(key, this->hash_function(), this->key_eq()); }
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- std::pair<iterator,iterator> equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func)
- { return this->priv_equal_range<iterator>(*this, key, hash_func, equal_func); }
-
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type &key) const
- { return this->equal_range(key, this->hash_function(), this->key_eq()); }
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- std::pair<const_iterator, const_iterator>
- equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const
- { return this->priv_equal_range<const_iterator>(*this, key, hash_func, equal_func); }
- #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
-
- iterator iterator_to(reference value);
-
- const_iterator iterator_to(const_reference value) const;
-
- static local_iterator s_local_iterator_to(reference value);
-
- static const_local_iterator s_local_iterator_to(const_reference value);
-
- local_iterator local_iterator_to(reference value);
-
- const_local_iterator local_iterator_to(const_reference value) const;
-
- size_type bucket_count() const;
-
- size_type bucket_size(size_type n) const;
-
- size_type bucket(const key_type& k) const;
-
- template<class KeyType, class KeyHasher>
- size_type bucket(const KeyType& k, KeyHasher hash_func) const;
-
- bucket_ptr bucket_pointer() const;
-
- local_iterator begin(size_type n);
-
- const_local_iterator begin(size_type n) const;
-
- const_local_iterator cbegin(size_type n) const;
-
- local_iterator end(size_type n);
-
- const_local_iterator end(size_type n) const;
-
- const_local_iterator cend(size_type n) const;
-
- void rehash(const bucket_traits &new_bucket_traits);
-
- void full_rehash();
-
- bool incremental_rehash(bool grow = true);
-
- bool incremental_rehash(const bucket_traits &new_bucket_traits);
-
- size_type split_count() const;
-
- static size_type suggested_upper_bucket_count(size_type n);
-
- static size_type suggested_lower_bucket_count(size_type n);
- #endif
- friend bool operator==(const unordered_set_impl &x, const unordered_set_impl &y)
- {
- if(table_type::constant_time_size && x.size() != y.size()){
- return false;
- }
-
- for (const_iterator ix = x.cbegin(), ex = x.cend(), ey = y.cend(); ix != ex; ++ix){
- const_iterator iy = y.find(key_of_value()(*ix));
- if (iy == ey || !(*ix == *iy))
- return false;
- }
- return true;
- }
- friend bool operator!=(const unordered_set_impl &x, const unordered_set_impl &y)
- { return !(x == y); }
- friend bool operator<(const unordered_set_impl &x, const unordered_set_impl &y)
- { return ::boost::intrusive::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
- friend bool operator>(const unordered_set_impl &x, const unordered_set_impl &y)
- { return y < x; }
- friend bool operator<=(const unordered_set_impl &x, const unordered_set_impl &y)
- { return !(y < x); }
- friend bool operator>=(const unordered_set_impl &x, const unordered_set_impl &y)
- { return !(x < y); }
- };
- #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- template<class T, class ...Options>
- #else
- template<class T, class O1 = void, class O2 = void
- , class O3 = void, class O4 = void
- , class O5 = void, class O6 = void
- , class O7 = void, class O8 = void
- , class O9 = void, class O10= void
- >
- #endif
- struct make_unordered_set
- {
-
- typedef typename pack_options
- < hashtable_defaults,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type packed_options;
- typedef typename detail::get_value_traits
- <T, typename packed_options::proto_value_traits>::type value_traits;
- typedef typename make_bucket_traits
- <T, true, packed_options>::type bucket_traits;
- typedef unordered_set_impl
- < value_traits
- , typename packed_options::key_of_value
- , typename packed_options::hash
- , typename packed_options::equal
- , typename packed_options::size_type
- , bucket_traits
- , (std::size_t(true)*hash_bool_flags::unique_keys_pos)
- | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos)
- | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos)
- | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos)
- | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos)
- | (std::size_t(packed_options::incremental)*hash_bool_flags::incremental_pos)
- > implementation_defined;
-
- typedef implementation_defined type;
- };
- #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
- #else
- template<class T, class ...Options>
- #endif
- class unordered_set
- : public make_unordered_set<T,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type
- {
- typedef typename make_unordered_set
- <T,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type Base;
-
- BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
- BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set)
- public:
- typedef typename Base::value_traits value_traits;
- typedef typename Base::bucket_traits bucket_traits;
- typedef typename Base::iterator iterator;
- typedef typename Base::const_iterator const_iterator;
- typedef typename Base::bucket_ptr bucket_ptr;
- typedef typename Base::size_type size_type;
- typedef typename Base::hasher hasher;
- typedef typename Base::key_equal key_equal;
- BOOST_INTRUSIVE_FORCEINLINE
- explicit unordered_set ( const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : Base(b_traits, hash_func, equal_func, v_traits)
- {}
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE
- unordered_set
- ( Iterator b, Iterator e
- , const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : Base(b, e, b_traits, hash_func, equal_func, v_traits)
- {}
- BOOST_INTRUSIVE_FORCEINLINE unordered_set(BOOST_RV_REF(unordered_set) x)
- : Base(BOOST_MOVE_BASE(Base, x))
- {}
- BOOST_INTRUSIVE_FORCEINLINE unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
- { return static_cast<unordered_set&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(const unordered_set &src, Cloner cloner, Disposer disposer)
- { Base::clone_from(src, cloner, disposer); }
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(unordered_set) src, Cloner cloner, Disposer disposer)
- { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
- };
- #endif
- #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
- template<class T, class ...Options>
- #else
- template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyHash, class VoidOrKeyEqual, class SizeType, class BucketTraits, std::size_t BoolFlags>
- #endif
- class unordered_multiset_impl
- : public hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags>
- {
-
- private:
- typedef hashtable_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags> table_type;
-
-
- BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset_impl)
- typedef table_type implementation_defined;
- public:
- typedef typename implementation_defined::value_type value_type;
- typedef typename implementation_defined::key_type key_type;
- typedef typename implementation_defined::value_traits value_traits;
- typedef typename implementation_defined::bucket_traits bucket_traits;
- typedef typename implementation_defined::pointer pointer;
- typedef typename implementation_defined::const_pointer const_pointer;
- typedef typename implementation_defined::reference reference;
- typedef typename implementation_defined::const_reference const_reference;
- typedef typename implementation_defined::difference_type difference_type;
- typedef typename implementation_defined::size_type size_type;
- typedef typename implementation_defined::key_equal key_equal;
- typedef typename implementation_defined::hasher hasher;
- typedef typename implementation_defined::bucket_type bucket_type;
- typedef typename implementation_defined::bucket_ptr bucket_ptr;
- typedef typename implementation_defined::iterator iterator;
- typedef typename implementation_defined::const_iterator const_iterator;
- typedef typename implementation_defined::insert_commit_data insert_commit_data;
- typedef typename implementation_defined::local_iterator local_iterator;
- typedef typename implementation_defined::const_local_iterator const_local_iterator;
- typedef typename implementation_defined::node_traits node_traits;
- typedef typename implementation_defined::node node;
- typedef typename implementation_defined::node_ptr node_ptr;
- typedef typename implementation_defined::const_node_ptr const_node_ptr;
- typedef typename implementation_defined::node_algorithms node_algorithms;
- public:
-
- BOOST_INTRUSIVE_FORCEINLINE explicit unordered_multiset_impl ( const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : table_type(b_traits, hash_func, equal_func, v_traits)
- {}
-
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE unordered_multiset_impl ( Iterator b
- , Iterator e
- , const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : table_type(false, b, e, b_traits, hash_func, equal_func, v_traits)
- {}
-
-
- BOOST_INTRUSIVE_FORCEINLINE unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
- : table_type(BOOST_MOVE_BASE(table_type, x))
- {}
-
-
- BOOST_INTRUSIVE_FORCEINLINE unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
- { return static_cast<unordered_multiset_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); }
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-
- ~unordered_multiset_impl();
-
- iterator begin();
-
- const_iterator begin() const;
-
- const_iterator cbegin() const;
-
- iterator end();
-
- const_iterator end() const;
-
- const_iterator cend() const;
-
- hasher hash_function() const;
-
- key_equal key_eq() const;
-
- bool empty() const;
-
- size_type size() const;
-
- void swap(unordered_multiset_impl& other);
-
- template <class Cloner, class Disposer>
- void clone_from(const unordered_multiset_impl &src, Cloner cloner, Disposer disposer);
- #else
- using table_type::clone_from;
- #endif
-
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(unordered_multiset_impl) src, Cloner cloner, Disposer disposer)
- { table_type::clone_from(BOOST_MOVE_BASE(table_type, src), cloner, disposer); }
-
- BOOST_INTRUSIVE_FORCEINLINE iterator insert(reference value)
- { return table_type::insert_equal(value); }
-
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE void insert(Iterator b, Iterator e)
- { table_type::insert_equal(b, e); }
- #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
-
- void erase(const_iterator i);
-
- void erase(const_iterator b, const_iterator e);
-
- size_type erase(const key_type &key);
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- size_type erase(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
-
- template<class Disposer>
- BOOST_INTRUSIVE_DOC1ST(void
- , typename detail::disable_if_convertible<Disposer BOOST_INTRUSIVE_I const_iterator>::type)
- erase_and_dispose(const_iterator i, Disposer disposer);
-
- template<class Disposer>
- void erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
-
- template<class Disposer>
- size_type erase_and_dispose(const key_type &key, Disposer disposer);
-
- template<class KeyType, class KeyHasher, class KeyEqual, class Disposer>
- size_type erase_and_dispose(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func, Disposer disposer);
-
- void clear();
-
- template<class Disposer>
- void clear_and_dispose(Disposer disposer);
-
- size_type count(const key_type &key) const;
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- size_type count(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
-
- iterator find(const key_type &key);
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
-
- const_iterator find(const key_type &key) const;
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- const_iterator find(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
-
- std::pair<iterator,iterator> equal_range(const key_type &key);
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- std::pair<iterator,iterator> equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func);
-
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type &key) const;
-
- template<class KeyType, class KeyHasher, class KeyEqual>
- std::pair<const_iterator, const_iterator>
- equal_range(const KeyType& key, KeyHasher hash_func, KeyEqual equal_func) const;
-
- iterator iterator_to(reference value);
-
- const_iterator iterator_to(const_reference value) const;
-
- static local_iterator s_local_iterator_to(reference value);
-
- static const_local_iterator s_local_iterator_to(const_reference value);
-
- local_iterator local_iterator_to(reference value);
-
- const_local_iterator local_iterator_to(const_reference value) const;
-
- size_type bucket_count() const;
-
- size_type bucket_size(size_type n) const;
-
- size_type bucket(const key_type& k) const;
-
- template<class KeyType, class KeyHasher>
- size_type bucket(const KeyType& k, KeyHasher hash_func) const;
-
- bucket_ptr bucket_pointer() const;
-
- local_iterator begin(size_type n);
-
- const_local_iterator begin(size_type n) const;
-
- const_local_iterator cbegin(size_type n) const;
-
- local_iterator end(size_type n);
-
- const_local_iterator end(size_type n) const;
-
- const_local_iterator cend(size_type n) const;
-
- void rehash(const bucket_traits &new_bucket_traits);
-
- void full_rehash();
-
- bool incremental_rehash(bool grow = true);
-
- bool incremental_rehash(const bucket_traits &new_bucket_traits);
-
- size_type split_count() const;
-
- static size_type suggested_upper_bucket_count(size_type n);
-
- static size_type suggested_lower_bucket_count(size_type n);
- #endif
- };
- #if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- template<class T, class ...Options>
- #else
- template<class T, class O1 = void, class O2 = void
- , class O3 = void, class O4 = void
- , class O5 = void, class O6 = void
- , class O7 = void, class O8 = void
- , class O9 = void, class O10= void
- >
- #endif
- struct make_unordered_multiset
- {
-
- typedef typename pack_options
- < hashtable_defaults,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type packed_options;
- typedef typename detail::get_value_traits
- <T, typename packed_options::proto_value_traits>::type value_traits;
- typedef typename make_bucket_traits
- <T, true, packed_options>::type bucket_traits;
- typedef unordered_multiset_impl
- < value_traits
- , typename packed_options::key_of_value
- , typename packed_options::hash
- , typename packed_options::equal
- , typename packed_options::size_type
- , bucket_traits
- , (std::size_t(false)*hash_bool_flags::unique_keys_pos)
- | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos)
- | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos)
- | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos)
- | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos)
- | (std::size_t(packed_options::incremental)*hash_bool_flags::incremental_pos)
- > implementation_defined;
-
- typedef implementation_defined type;
- };
- #ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- template<class T, class O1, class O2, class O3, class O4, class O5, class O6, class O7, class O8, class O9, class O10>
- #else
- template<class T, class ...Options>
- #endif
- class unordered_multiset
- : public make_unordered_multiset<T,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type
- {
- typedef typename make_unordered_multiset
- <T,
- #if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
- O1, O2, O3, O4, O5, O6, O7, O8, O9, O10
- #else
- Options...
- #endif
- >::type Base;
-
- BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
- BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset)
- public:
- typedef typename Base::value_traits value_traits;
- typedef typename Base::bucket_traits bucket_traits;
- typedef typename Base::iterator iterator;
- typedef typename Base::const_iterator const_iterator;
- typedef typename Base::bucket_ptr bucket_ptr;
- typedef typename Base::size_type size_type;
- typedef typename Base::hasher hasher;
- typedef typename Base::key_equal key_equal;
- BOOST_INTRUSIVE_FORCEINLINE
- explicit unordered_multiset( const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : Base(b_traits, hash_func, equal_func, v_traits)
- {}
- template<class Iterator>
- BOOST_INTRUSIVE_FORCEINLINE
- unordered_multiset( Iterator b
- , Iterator e
- , const bucket_traits &b_traits
- , const hasher & hash_func = hasher()
- , const key_equal &equal_func = key_equal()
- , const value_traits &v_traits = value_traits())
- : Base(b, e, b_traits, hash_func, equal_func, v_traits)
- {}
- BOOST_INTRUSIVE_FORCEINLINE unordered_multiset(BOOST_RV_REF(unordered_multiset) x)
- : Base(BOOST_MOVE_BASE(Base, x))
- {}
- BOOST_INTRUSIVE_FORCEINLINE unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
- { return static_cast<unordered_multiset&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(const unordered_multiset &src, Cloner cloner, Disposer disposer)
- { Base::clone_from(src, cloner, disposer); }
- template <class Cloner, class Disposer>
- BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(unordered_multiset) src, Cloner cloner, Disposer disposer)
- { Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
- };
- #endif
- }
- }
- #include <boost/intrusive/detail/config_end.hpp>
- #endif
|