From a3e57838ed7b8b8477aee063472c71fa7d1c636d Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 27 Oct 2009 19:39:33 +0000 Subject: [PATCH] Merged revisions 57126,57139,57150-57153 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r57126 | danieljames | 2009-10-24 12:56:30 +0100 (Sat, 24 Oct 2009) | 1 line Update the intel compile flags. ........ r57139 | danieljames | 2009-10-24 18:53:03 +0100 (Sat, 24 Oct 2009) | 1 line Fix unordered for intel strict. ........ r57150 | danieljames | 2009-10-25 10:54:28 +0000 (Sun, 25 Oct 2009) | 1 line Fix the intel strict flag. ........ r57151 | danieljames | 2009-10-25 10:54:53 +0000 (Sun, 25 Oct 2009) | 1 line Remove insert empty initializer lists, as there's a bug in gcc. ........ r57152 | danieljames | 2009-10-25 10:55:08 +0000 (Sun, 25 Oct 2009) | 1 line Slightly rearrange the unordered container headers so that prev_prime is defined before it's used. ........ r57153 | danieljames | 2009-10-25 10:55:27 +0000 (Sun, 25 Oct 2009) | 1 line Remove 'grouped' from hash_table as it isn't used and is a bit confusing. ........ [SVN r57179] --- include/boost/unordered/detail/buckets.hpp | 7 +++++++ include/boost/unordered/detail/equivalent.hpp | 10 +++++----- include/boost/unordered/detail/fwd.hpp | 15 +++++---------- include/boost/unordered/detail/table.hpp | 1 - include/boost/unordered/detail/unique.hpp | 17 ++++++++--------- test/exception/Jamfile.v2 | 6 +----- test/unordered/Jamfile.v2 | 7 ++++--- test/unordered/insert_tests.cpp | 6 +++--- 8 files changed, 33 insertions(+), 36 deletions(-) diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index 0f513e44..c4b8a898 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -10,12 +10,19 @@ #include #include #include +#include namespace boost { namespace unordered_detail { //////////////////////////////////////////////////////////////////////////// // Buckets + template + inline std::size_t hash_buckets::max_bucket_count() const { + // -1 to account for the sentinel. + return prev_prime(this->bucket_alloc().max_size() - 1); + } + template inline BOOST_DEDUCED_TYPENAME hash_buckets::bucket_ptr hash_buckets::get_bucket(std::size_t num) const diff --git a/include/boost/unordered/detail/equivalent.hpp b/include/boost/unordered/detail/equivalent.hpp index 7e52a609..970c18bc 100644 --- a/include/boost/unordered/detail/equivalent.hpp +++ b/include/boost/unordered/detail/equivalent.hpp @@ -28,7 +28,7 @@ namespace boost { namespace unordered_detail { node_ptr it1 = i->next_; while(BOOST_UNORDERED_BORLAND_BOOL(it1)) { - node_ptr it2 = other.find_iterator(get_key_from_ptr(it1)); + node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; node_ptr end1 = node::next_group(it1); @@ -77,7 +77,7 @@ namespace boost { namespace unordered_detail { hash_equivalent_table::iterator_base hash_equivalent_table::emplace_impl(node_constructor& a) { - key_type const& k = get_key(a.value()); + key_type const& k = this->get_key(a.value()); std::size_t hash_value = this->hash_function()(k); if(!this->size_) { @@ -85,7 +85,7 @@ namespace boost { namespace unordered_detail { } else { bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr position = find_iterator(bucket, k); + node_ptr position = this->find_iterator(bucket, k); // reserve has basic exception safety if the hash function // throws, strong otherwise. @@ -100,9 +100,9 @@ namespace boost { namespace unordered_detail { inline void hash_equivalent_table ::emplace_impl_no_rehash(node_constructor& a) { - key_type const& k = get_key(a.value()); + key_type const& k = this->get_key(a.value()); bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - add_node(a, bucket, find_iterator(bucket, k)); + add_node(a, bucket, this->find_iterator(bucket, k)); } #if defined(BOOST_UNORDERED_STD_FORWARD) diff --git a/include/boost/unordered/detail/fwd.hpp b/include/boost/unordered/detail/fwd.hpp index 3a5e3f73..5696cbca 100644 --- a/include/boost/unordered/detail/fwd.hpp +++ b/include/boost/unordered/detail/fwd.hpp @@ -298,10 +298,7 @@ namespace boost { namespace unordered_detail { return allocators_.first(); } node_allocator& node_alloc() { return allocators_.second(); } - std::size_t max_bucket_count() const { - // -1 to account for the sentinel. - return prev_prime(this->bucket_alloc().max_size() - 1); - } + std::size_t max_bucket_count() const; // Constructors @@ -443,7 +440,6 @@ namespace boost { namespace unordered_detail { typedef H hasher; typedef P key_equal; typedef A value_allocator; - typedef G grouped; typedef K key_extractor; typedef hash_buffered_functions base; typedef hash_buckets buckets; @@ -575,7 +571,7 @@ namespace boost { namespace unordered_detail { template class hash_unique_table : - public hash_table + public hash_table { public: @@ -669,7 +665,7 @@ namespace boost { namespace unordered_detail { template class hash_equivalent_table : - public hash_table + public hash_table { public: @@ -678,9 +674,8 @@ namespace boost { namespace unordered_detail { typedef A value_allocator; typedef K key_extractor; - typedef hash_table table; - typedef hash_node_constructor - node_constructor; + typedef hash_table table; + typedef hash_node_constructor node_constructor; typedef hash_iterator_base iterator_base; typedef BOOST_DEDUCED_TYPENAME table::key_type key_type; diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index bba3a07f..66c9d744 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -14,7 +14,6 @@ #include #include -#include namespace boost { namespace unordered_detail { diff --git a/include/boost/unordered/detail/unique.hpp b/include/boost/unordered/detail/unique.hpp index 552a1d51..b696e1a0 100644 --- a/include/boost/unordered/detail/unique.hpp +++ b/include/boost/unordered/detail/unique.hpp @@ -28,7 +28,7 @@ namespace boost { namespace unordered_detail { node_ptr it1 = i->next_; while(BOOST_UNORDERED_BORLAND_BOOL(it1)) { - node_ptr it2 = other.find_iterator(get_key_from_ptr(it1)); + node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; if(!extractor::compare_mapped( node::get_value(it1), node::get_value(it2))) @@ -76,7 +76,7 @@ namespace boost { namespace unordered_detail { return *this->emplace_empty_impl_with_node(a, 1); } - node_ptr pos = find_iterator(bucket, k); + node_ptr pos = this->find_iterator(bucket, k); if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { return node::get_value(pos); @@ -102,14 +102,13 @@ namespace boost { namespace unordered_detail { template inline BOOST_DEDUCED_TYPENAME hash_unique_table::emplace_return - hash_unique_table - ::emplace_impl_with_node(node_constructor& a) + hash_unique_table::emplace_impl_with_node(node_constructor& a) { // No side effects in this initial code - key_type const& k = get_key(a.value()); + key_type const& k = this->get_key(a.value()); std::size_t hash_value = this->hash_function()(k); bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = find_iterator(bucket, k); + node_ptr pos = this->find_iterator(bucket, k); if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { // Found an existing key, return it (no throw). @@ -139,7 +138,7 @@ namespace boost { namespace unordered_detail { // No side effects in this initial code std::size_t hash_value = this->hash_function()(k); bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = find_iterator(bucket, k); + node_ptr pos = this->find_iterator(bucket, k); if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { // Found an existing key, return it (no throw). @@ -203,7 +202,7 @@ namespace boost { namespace unordered_detail { std::size_t hash_value = this->hash_function()(k); \ bucket_ptr bucket \ = this->bucket_ptr_from_hash(hash_value); \ - node_ptr pos = find_iterator(bucket, k); \ + node_ptr pos = this->find_iterator(bucket, k); \ \ if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { \ return emplace_return(iterator_base(bucket, pos), false); \ @@ -330,7 +329,7 @@ namespace boost { namespace unordered_detail { key_type const& k = extractor::extract(*i); std::size_t hash_value = this->hash_function()(k); bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = find_iterator(bucket, k); + node_ptr pos = this->find_iterator(bucket, k); if (!BOOST_UNORDERED_BORLAND_BOOL(pos)) { // Doesn't already exist, add to bucket. diff --git a/test/exception/Jamfile.v2 b/test/exception/Jamfile.v2 index 92e25055..a8508588 100644 --- a/test/exception/Jamfile.v2 +++ b/test/exception/Jamfile.v2 @@ -8,11 +8,7 @@ import testing ; #alias framework : /boost/test//boost_unit_test_framework ; alias framework : ; -project unordered-test/exception-tests - : requirements - intel-linux:"-strict_ansi -cxxlib-icc" - gcc:"-Wsign-promo -Wunused-parameter" - ; +project unordered-test/exception-tests ; test-suite unordered-exception : diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index ee1505f7..882ec132 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -7,10 +7,11 @@ import testing ; project unordered-test/unordered : requirements - intel-linux:"-strict_ansi -cxxlib-icc" - gcc:"-Wsign-promo -Wunused-parameter" - #msvc:/W4 all + intel:on + intel:-strict-ansi + msvc:/W4 + gcc:"-Wsign-promo -Wunused-parameter -pedantic" ; test-suite unordered diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index a277cbb7..b116acc0 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -407,7 +407,7 @@ UNORDERED_AUTO_TEST(insert_initializer_list_set) UNORDERED_AUTO_TEST(insert_initializer_list_multiset) { boost::unordered_multiset multiset; - multiset.insert({}); + //multiset.insert({}); BOOST_TEST(multiset.empty()); multiset.insert({"a"}); BOOST_TEST_EQ(multiset.size(), 1u); @@ -423,7 +423,7 @@ UNORDERED_AUTO_TEST(insert_initializer_list_multiset) UNORDERED_AUTO_TEST(insert_initializer_list_map) { boost::unordered_map map; - map.insert({}); + //map.insert({}); BOOST_TEST(map.empty()); map.insert({{"a", "b"},{"a", "b"},{"d", ""}}); BOOST_TEST_EQ(map.size(), 2u); @@ -432,7 +432,7 @@ UNORDERED_AUTO_TEST(insert_initializer_list_map) UNORDERED_AUTO_TEST(insert_initializer_list_multimap) { boost::unordered_multimap multimap; - multimap.insert({}); + //multimap.insert({}); BOOST_TEST(multimap.empty()); multimap.insert({{"a", "b"},{"a", "b"},{"d", ""}}); BOOST_TEST_EQ(multimap.size(), 3u);