Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80508 - in trunk: boost/unordered/detail libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2012-09-12 17:09:39


Author: danieljames
Date: 2012-09-12 17:09:39 EDT (Wed, 12 Sep 2012)
New Revision: 80508
URL: http://svn.boost.org/trac/boost/changeset/80508

Log:
Unordered: Fix incorrect assertion.
Text files modified:
   trunk/boost/unordered/detail/equivalent.hpp | 2 +-
   trunk/boost/unordered/detail/unique.hpp | 2 +-
   trunk/libs/unordered/test/unordered/insert_tests.cpp | 18 ++++++++++++++++++
   3 files changed, 20 insertions(+), 2 deletions(-)

Modified: trunk/boost/unordered/detail/equivalent.hpp
==============================================================================
--- trunk/boost/unordered/detail/equivalent.hpp (original)
+++ trunk/boost/unordered/detail/equivalent.hpp 2012-09-12 17:09:39 EDT (Wed, 12 Sep 2012)
@@ -748,7 +748,7 @@
         // strong otherwise exception safety
         void rehash_impl(std::size_t num_buckets)
         {
- BOOST_ASSERT(this->size_);
+ BOOST_ASSERT(this->buckets_);
 
             this->create_buckets(num_buckets);
             previous_pointer prev = this->get_previous_start();

Modified: trunk/boost/unordered/detail/unique.hpp
==============================================================================
--- trunk/boost/unordered/detail/unique.hpp (original)
+++ trunk/boost/unordered/detail/unique.hpp 2012-09-12 17:09:39 EDT (Wed, 12 Sep 2012)
@@ -636,7 +636,7 @@
         // strong otherwise exception safety
         void rehash_impl(std::size_t num_buckets)
         {
- BOOST_ASSERT(this->size_);
+ BOOST_ASSERT(this->buckets_);
 
             this->create_buckets(num_buckets);
             previous_pointer prev = this->get_previous_start();

Modified: trunk/libs/unordered/test/unordered/insert_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/unordered/insert_tests.cpp (original)
+++ trunk/libs/unordered/test/unordered/insert_tests.cpp 2012-09-12 17:09:39 EDT (Wed, 12 Sep 2012)
@@ -229,6 +229,24 @@
         test::check_equivalent_keys(x);
     }
 
+ std::cerr<<"insert range with rehash tests.\n";
+
+ {
+ test::check_instances check_;
+
+ X x;
+
+ test::random_values<X> v(1000, generator);
+
+ x.insert(*v.begin());
+ x.clear();
+
+ x.insert(v.begin(), v.end());
+
+ test::check_container(x, v);
+ test::check_equivalent_keys(x);
+ }
+
     std::cerr<<"insert input iterator range tests.\n";
 
     {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk