Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2007-12-20 16:17:39


Author: danieljames
Date: 2007-12-20 16:17:38 EST (Thu, 20 Dec 2007)
New Revision: 42216
URL: http://svn.boost.org/trac/boost/changeset/42216

Log:
I messed up the last commit, this fixes it.
Text files modified:
   branches/unordered/dev/boost/unordered/detail/hash_table_impl.hpp | 27 ++++++++++++++-------------
   1 files changed, 14 insertions(+), 13 deletions(-)

Modified: branches/unordered/dev/boost/unordered/detail/hash_table_impl.hpp
==============================================================================
--- branches/unordered/dev/boost/unordered/detail/hash_table_impl.hpp (original)
+++ branches/unordered/dev/boost/unordered/detail/hash_table_impl.hpp 2007-12-20 16:17:38 EST (Thu, 20 Dec 2007)
@@ -244,11 +244,21 @@
             }
 
             // pre: Must be pointing to the first node in a group.
+ static inline link_ptr last_in_group(link_ptr n) {
+ BOOST_ASSERT(BOOST_UNORDERED_BORLAND_BOOL(n) && n != prev_in_group(n)->next_);
+ return prev_in_group(n);
+ }
+
+ // pre: Must be pointing to the first node in a group.
             static inline link_ptr& next_group(link_ptr n) {
                 BOOST_ASSERT(BOOST_UNORDERED_BORLAND_BOOL(n) && n != prev_in_group(n)->next_);
                 return prev_in_group(n)->next_;
             }
 #else
+ static inline link_ptr last_in_group(link_ptr n) {
+ return n;
+ }
+
             static inline link_ptr& next_group(link_ptr n) {
                 BOOST_ASSERT(n);
                 return n->next_;
@@ -311,16 +321,6 @@
                         node_ = bucket_->next_;
                     }
                 }
-
- void incrementGroup()
- {
- node_ = data::next_group(node_);
-
- while (!node_) {
- ++bucket_;
- node_ = bucket_->next_;
- }
- }
             };
 
             // Member Variables
@@ -627,7 +627,8 @@
             {
                 size_type count = group_count(*pos);
                 size_ -= count;
- *pos = next_group(*pos);
+ link_ptr last = last_in_group(*pos);
+ *pos = last->next_;
                 return count;
             }
 #else
@@ -1826,8 +1827,8 @@
                 link_ptr it = find_iterator(bucket, k);
                 if (BOOST_UNORDERED_BORLAND_BOOL(it)) {
                     iterator_base first(iterator_base(bucket, it));
- iterator_base second(first);
- second.incrementGroup();
+ iterator_base second(iterator_base(bucket, this->last_in_group(it)));
+ second.increment();
                     return std::pair<iterator_base, iterator_base>(first, second);
                 }
                 else {


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