Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56348 - trunk/boost/unordered/detail
From: daniel_james_at_[hidden]
Date: 2009-09-21 17:18:01


Author: danieljames
Date: 2009-09-21 17:18:01 EDT (Mon, 21 Sep 2009)
New Revision: 56348
URL: http://svn.boost.org/trac/boost/changeset/56348

Log:
Fix a bug that was causing unnecessary rehahes.
Text files modified:
   trunk/boost/unordered/detail/table.hpp | 8 ++------
   1 files changed, 2 insertions(+), 6 deletions(-)

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2009-09-21 17:18:01 EDT (Mon, 21 Sep 2009)
@@ -443,23 +443,19 @@
             this->create_buckets();
             this->init_buckets();
         }
- // TODO: Another bug:
- else if(min_buckets != this->bucket_count_) {
+ else {
             // no throw:
             // TODO: Needlessly calling next_prime twice.
             std::size_t min_size = this->min_buckets_for_size(this->size_);
             min_buckets = next_prime(min_buckets);
             min_buckets = min_size > min_buckets ? min_size : min_buckets;
-
- rehash_impl(min_buckets);
+ if(min_buckets != this->bucket_count_) rehash_impl(min_buckets);
         }
     }
 
     // if hash function throws, basic exception safety
     // strong otherwise
 
- // TODO: Rewrite so that it doesn't need to keep updating size_.
-
     template <class H, class P, class A, class G, class K>
     void hash_table<H, P, A, G, K>
         ::rehash_impl(std::size_t num_buckets)


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