Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/intrusive/unordered_set.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
1 ///////////////////////////////////////////////////////////////////////////// | 1 ///////////////////////////////////////////////////////////////////////////// |
2 // | 2 // |
3 // (C) Copyright Olaf Krzikalla 2004-2006. | 3 // (C) Copyright Olaf Krzikalla 2004-2006. |
4 // (C) Copyright Ion Gaztanaga 2006-2013 | 4 // (C) Copyright Ion Gaztanaga 2006-2014 |
5 // | 5 // |
6 // Distributed under the Boost Software License, Version 1.0. | 6 // Distributed under the Boost Software License, Version 1.0. |
7 // (See accompanying file LICENSE_1_0.txt or copy at | 7 // (See accompanying file LICENSE_1_0.txt or copy at |
8 // http://www.boost.org/LICENSE_1_0.txt) | 8 // http://www.boost.org/LICENSE_1_0.txt) |
9 // | 9 // |
14 #define BOOST_INTRUSIVE_UNORDERED_SET_HPP | 14 #define BOOST_INTRUSIVE_UNORDERED_SET_HPP |
15 | 15 |
16 #include <boost/intrusive/detail/config_begin.hpp> | 16 #include <boost/intrusive/detail/config_begin.hpp> |
17 #include <boost/intrusive/intrusive_fwd.hpp> | 17 #include <boost/intrusive/intrusive_fwd.hpp> |
18 #include <boost/intrusive/hashtable.hpp> | 18 #include <boost/intrusive/hashtable.hpp> |
19 #include <boost/move/move.hpp> | 19 #include <boost/move/utility_core.hpp> |
20 #include <iterator> | 20 #include <boost/static_assert.hpp> |
21 | 21 |
22 #if defined(BOOST_HAS_PRAGMA_ONCE) | |
23 # pragma once | |
24 #endif | |
22 | 25 |
23 namespace boost { | 26 namespace boost { |
24 namespace intrusive { | 27 namespace intrusive { |
25 | 28 |
26 //! The class template unordered_set is an intrusive container, that mimics most of | 29 //! The class template unordered_set is an intrusive container, that mimics most of |
129 //! and Dereferencing iterator must yield an lvalue of type value_type. | 132 //! and Dereferencing iterator must yield an lvalue of type value_type. |
130 //! | 133 //! |
131 //! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from | 134 //! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from |
132 //! [b, e). | 135 //! [b, e). |
133 //! | 136 //! |
134 //! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N) | 137 //! <b>Complexity</b>: If N is distance(b, e): Average case is O(N) |
135 //! (with a good hash function and with buckets_len >= N),worst case O(N2). | 138 //! (with a good hash function and with buckets_len >= N),worst case O(N2). |
136 //! | 139 //! |
137 //! <b>Throws</b>: If value_traits::node_traits::node | 140 //! <b>Throws</b>: If value_traits::node_traits::node |
138 //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) | 141 //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) |
139 //! or the copy constructor or invocation of hasher or key_equal throws. | 142 //! or the copy constructor or invocation of hasher or key_equal throws. |
151 { table_type::insert_unique(b, e); } | 154 { table_type::insert_unique(b, e); } |
152 | 155 |
153 //! <b>Effects</b>: to-do | 156 //! <b>Effects</b>: to-do |
154 //! | 157 //! |
155 unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x) | 158 unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x) |
156 : table_type(::boost::move(static_cast<table_type&>(x))) | 159 : table_type(BOOST_MOVE_BASE(table_type, x)) |
157 {} | 160 {} |
158 | 161 |
159 //! <b>Effects</b>: to-do | 162 //! <b>Effects</b>: to-do |
160 //! | 163 //! |
161 unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x) | 164 unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x) |
162 { return static_cast<unordered_set_impl&>(table_type::operator=(::boost::move(static_cast<table_type&>(x)))); } | 165 { return static_cast<unordered_set_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); } |
163 | 166 |
164 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED | 167 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED |
165 //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set | 168 //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set |
166 //! are not deleted (i.e. no destructors are called). | 169 //! are not deleted (i.e. no destructors are called). |
167 //! | 170 //! |
320 //! <b>Requires</b>: Dereferencing iterator must yield an lvalue | 323 //! <b>Requires</b>: Dereferencing iterator must yield an lvalue |
321 //! of type value_type. | 324 //! of type value_type. |
322 //! | 325 //! |
323 //! <b>Effects</b>: Equivalent to this->insert(t) for each element in [b, e). | 326 //! <b>Effects</b>: Equivalent to this->insert(t) for each element in [b, e). |
324 //! | 327 //! |
325 //! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e). | 328 //! <b>Complexity</b>: Average case O(N), where N is distance(b, e). |
326 //! Worst case O(N*this->size()). | 329 //! Worst case O(N*this->size()). |
327 //! | 330 //! |
328 //! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee. | 331 //! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee. |
329 //! | 332 //! |
330 //! <b>Note</b>: Does not affect the validity of iterators and references. | 333 //! <b>Note</b>: Does not affect the validity of iterators and references. |
408 void erase(const_iterator i) | 411 void erase(const_iterator i) |
409 { table_type::erase(i); } | 412 { table_type::erase(i); } |
410 | 413 |
411 //! <b>Effects</b>: Erases the range pointed to by b end e. | 414 //! <b>Effects</b>: Erases the range pointed to by b end e. |
412 //! | 415 //! |
413 //! <b>Complexity</b>: Average case O(std::distance(b, e)), | 416 //! <b>Complexity</b>: Average case O(distance(b, e)), |
414 //! worst case O(this->size()). | 417 //! worst case O(this->size()). |
415 //! | 418 //! |
416 //! <b>Throws</b>: Nothing. | 419 //! <b>Throws</b>: Nothing. |
417 //! | 420 //! |
418 //! <b>Note</b>: Invalidates the iterators (but not the references) | 421 //! <b>Note</b>: Invalidates the iterators (but not the references) |
480 //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. | 483 //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. |
481 //! | 484 //! |
482 //! <b>Effects</b>: Erases the range pointed to by b end e. | 485 //! <b>Effects</b>: Erases the range pointed to by b end e. |
483 //! Disposer::operator()(pointer) is called for the removed elements. | 486 //! Disposer::operator()(pointer) is called for the removed elements. |
484 //! | 487 //! |
485 //! <b>Complexity</b>: Average case O(std::distance(b, e)), | 488 //! <b>Complexity</b>: Average case O(distance(b, e)), |
486 //! worst case O(this->size()). | 489 //! worst case O(this->size()). |
487 //! | 490 //! |
488 //! <b>Throws</b>: Nothing. | 491 //! <b>Throws</b>: Nothing. |
489 //! | 492 //! |
490 //! <b>Note</b>: Invalidates the iterators | 493 //! <b>Note</b>: Invalidates the iterators |
1027 >::type packed_options; | 1030 >::type packed_options; |
1028 | 1031 |
1029 typedef typename detail::get_value_traits | 1032 typedef typename detail::get_value_traits |
1030 <T, typename packed_options::proto_value_traits>::type value_traits; | 1033 <T, typename packed_options::proto_value_traits>::type value_traits; |
1031 | 1034 |
1032 typedef typename make_real_bucket_traits | 1035 typedef typename make_bucket_traits |
1033 <T, true, packed_options>::type real_bucket_traits; | 1036 <T, true, packed_options>::type bucket_traits; |
1034 | 1037 |
1035 typedef unordered_set_impl | 1038 typedef unordered_set_impl |
1036 < value_traits | 1039 < value_traits |
1037 , typename packed_options::hash | 1040 , typename packed_options::hash |
1038 , typename packed_options::equal | 1041 , typename packed_options::equal |
1039 , typename packed_options::size_type | 1042 , typename packed_options::size_type |
1040 , real_bucket_traits | 1043 , bucket_traits |
1041 , (std::size_t(true)*hash_bool_flags::unique_keys_pos) | 1044 , (std::size_t(true)*hash_bool_flags::unique_keys_pos) |
1042 | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos) | 1045 | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos) |
1043 | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos) | 1046 | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos) |
1044 | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos) | 1047 | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos) |
1045 | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos) | 1048 | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos) |
1105 , const value_traits &v_traits = value_traits()) | 1108 , const value_traits &v_traits = value_traits()) |
1106 : Base(b, e, b_traits, hash_func, equal_func, v_traits) | 1109 : Base(b, e, b_traits, hash_func, equal_func, v_traits) |
1107 {} | 1110 {} |
1108 | 1111 |
1109 unordered_set(BOOST_RV_REF(unordered_set) x) | 1112 unordered_set(BOOST_RV_REF(unordered_set) x) |
1110 : Base(::boost::move(static_cast<Base&>(x))) | 1113 : Base(BOOST_MOVE_BASE(Base, x)) |
1111 {} | 1114 {} |
1112 | 1115 |
1113 unordered_set& operator=(BOOST_RV_REF(unordered_set) x) | 1116 unordered_set& operator=(BOOST_RV_REF(unordered_set) x) |
1114 { return static_cast<unordered_set&>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } | 1117 { return static_cast<unordered_set&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } |
1115 }; | 1118 }; |
1116 | 1119 |
1117 #endif | 1120 #endif |
1118 | 1121 |
1119 | 1122 |
1222 //! and Dereferencing iterator must yield an lvalue of type value_type. | 1225 //! and Dereferencing iterator must yield an lvalue of type value_type. |
1223 //! | 1226 //! |
1224 //! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from | 1227 //! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from |
1225 //! [b, e). | 1228 //! [b, e). |
1226 //! | 1229 //! |
1227 //! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N) | 1230 //! <b>Complexity</b>: If N is distance(b, e): Average case is O(N) |
1228 //! (with a good hash function and with buckets_len >= N),worst case O(N2). | 1231 //! (with a good hash function and with buckets_len >= N),worst case O(N2). |
1229 //! | 1232 //! |
1230 //! <b>Throws</b>: If value_traits::node_traits::node | 1233 //! <b>Throws</b>: If value_traits::node_traits::node |
1231 //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) | 1234 //! constructor throws (this does not happen with predefined Boost.Intrusive hooks) |
1232 //! or the copy constructor or invocation of hasher or key_equal throws. | 1235 //! or the copy constructor or invocation of hasher or key_equal throws. |
1244 { table_type::insert_equal(b, e); } | 1247 { table_type::insert_equal(b, e); } |
1245 | 1248 |
1246 //! <b>Effects</b>: to-do | 1249 //! <b>Effects</b>: to-do |
1247 //! | 1250 //! |
1248 unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x) | 1251 unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x) |
1249 : table_type(::boost::move(static_cast<table_type&>(x))) | 1252 : table_type(BOOST_MOVE_BASE(table_type, x)) |
1250 {} | 1253 {} |
1251 | 1254 |
1252 //! <b>Effects</b>: to-do | 1255 //! <b>Effects</b>: to-do |
1253 //! | 1256 //! |
1254 unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x) | 1257 unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x) |
1255 { return static_cast<unordered_multiset_impl&>(table_type::operator=(::boost::move(static_cast<table_type&>(x)))); } | 1258 { return static_cast<unordered_multiset_impl&>(table_type::operator=(BOOST_MOVE_BASE(table_type, x))); } |
1256 | 1259 |
1257 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED | 1260 #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED |
1258 | 1261 |
1259 //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset | 1262 //! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset |
1260 //! are not deleted (i.e. no destructors are called). | 1263 //! are not deleted (i.e. no destructors are called). |
1437 void erase(const_iterator i) | 1440 void erase(const_iterator i) |
1438 { table_type::erase(i); } | 1441 { table_type::erase(i); } |
1439 | 1442 |
1440 //! <b>Effects</b>: Erases the range pointed to by b end e. | 1443 //! <b>Effects</b>: Erases the range pointed to by b end e. |
1441 //! | 1444 //! |
1442 //! <b>Complexity</b>: Average case O(std::distance(b, e)), | 1445 //! <b>Complexity</b>: Average case O(distance(b, e)), |
1443 //! worst case O(this->size()). | 1446 //! worst case O(this->size()). |
1444 //! | 1447 //! |
1445 //! <b>Throws</b>: Nothing. | 1448 //! <b>Throws</b>: Nothing. |
1446 //! | 1449 //! |
1447 //! <b>Note</b>: Invalidates the iterators (but not the references) | 1450 //! <b>Note</b>: Invalidates the iterators (but not the references) |
1516 //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. | 1519 //! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw. |
1517 //! | 1520 //! |
1518 //! <b>Effects</b>: Erases the range pointed to by b end e. | 1521 //! <b>Effects</b>: Erases the range pointed to by b end e. |
1519 //! Disposer::operator()(pointer) is called for the removed elements. | 1522 //! Disposer::operator()(pointer) is called for the removed elements. |
1520 //! | 1523 //! |
1521 //! <b>Complexity</b>: Average case O(std::distance(b, e)), | 1524 //! <b>Complexity</b>: Average case O(distance(b, e)), |
1522 //! worst case O(this->size()). | 1525 //! worst case O(this->size()). |
1523 //! | 1526 //! |
1524 //! <b>Throws</b>: Nothing. | 1527 //! <b>Throws</b>: Nothing. |
1525 //! | 1528 //! |
1526 //! <b>Note</b>: Invalidates the iterators | 1529 //! <b>Note</b>: Invalidates the iterators |
2064 >::type packed_options; | 2067 >::type packed_options; |
2065 | 2068 |
2066 typedef typename detail::get_value_traits | 2069 typedef typename detail::get_value_traits |
2067 <T, typename packed_options::proto_value_traits>::type value_traits; | 2070 <T, typename packed_options::proto_value_traits>::type value_traits; |
2068 | 2071 |
2069 typedef typename make_real_bucket_traits | 2072 typedef typename make_bucket_traits |
2070 <T, true, packed_options>::type real_bucket_traits; | 2073 <T, true, packed_options>::type bucket_traits; |
2071 | 2074 |
2072 typedef unordered_multiset_impl | 2075 typedef unordered_multiset_impl |
2073 < value_traits | 2076 < value_traits |
2074 , typename packed_options::hash | 2077 , typename packed_options::hash |
2075 , typename packed_options::equal | 2078 , typename packed_options::equal |
2076 , typename packed_options::size_type | 2079 , typename packed_options::size_type |
2077 , real_bucket_traits | 2080 , bucket_traits |
2078 , (std::size_t(false)*hash_bool_flags::unique_keys_pos) | 2081 , (std::size_t(false)*hash_bool_flags::unique_keys_pos) |
2079 | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos) | 2082 | (std::size_t(packed_options::constant_time_size)*hash_bool_flags::constant_time_size_pos) |
2080 | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos) | 2083 | (std::size_t(packed_options::power_2_buckets)*hash_bool_flags::power_2_buckets_pos) |
2081 | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos) | 2084 | (std::size_t(packed_options::cache_begin)*hash_bool_flags::cache_begin_pos) |
2082 | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos) | 2085 | (std::size_t(packed_options::compare_hash)*hash_bool_flags::compare_hash_pos) |
2141 , const value_traits &v_traits = value_traits()) | 2144 , const value_traits &v_traits = value_traits()) |
2142 : Base(b, e, b_traits, hash_func, equal_func, v_traits) | 2145 : Base(b, e, b_traits, hash_func, equal_func, v_traits) |
2143 {} | 2146 {} |
2144 | 2147 |
2145 unordered_multiset(BOOST_RV_REF(unordered_multiset) x) | 2148 unordered_multiset(BOOST_RV_REF(unordered_multiset) x) |
2146 : Base(::boost::move(static_cast<Base&>(x))) | 2149 : Base(BOOST_MOVE_BASE(Base, x)) |
2147 {} | 2150 {} |
2148 | 2151 |
2149 unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x) | 2152 unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x) |
2150 { return static_cast<unordered_multiset&>(this->Base::operator=(::boost::move(static_cast<Base&>(x)))); } | 2153 { return static_cast<unordered_multiset&>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); } |
2151 }; | 2154 }; |
2152 | 2155 |
2153 #endif | 2156 #endif |
2154 | 2157 |
2155 } //namespace intrusive | 2158 } //namespace intrusive |