|
Boost-Commit : |
From: daniel_james_at_[hidden]
Date: 2007-12-20 16:22:20
Author: danieljames
Date: 2007-12-20 16:22:20 EST (Thu, 20 Dec 2007)
New Revision: 42218
URL: http://svn.boost.org/trac/boost/changeset/42218
Log:
Get rid of last_in_group.
Text files modified:
branches/unordered/dev/boost/unordered/detail/hash_table_impl.hpp | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 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:22:20 EST (Thu, 20 Dec 2007)
@@ -32,6 +32,8 @@
class BOOST_UNORDERED_TABLE_DATA
{
public:
+ typedef BOOST_UNORDERED_TABLE_DATA data;
+
struct node_base;
struct node;
struct bucket;
@@ -244,21 +246,11 @@
}
// 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_;
@@ -321,6 +313,16 @@
node_ = bucket_->next_;
}
}
+
+ void incrementGroup()
+ {
+ node_ = data::next_group(node_);
+
+ while (!node_) {
+ ++bucket_;
+ node_ = bucket_->next_;
+ }
+ }
};
// Member Variables
@@ -627,8 +629,7 @@
{
size_type count = group_count(*pos);
size_ -= count;
- link_ptr last = last_in_group(*pos);
- *pos = last->next_;
+ *pos = next_group(*pos);
return count;
}
#else
@@ -1827,8 +1828,8 @@
link_ptr it = find_iterator(bucket, k);
if (BOOST_UNORDERED_BORLAND_BOOL(it)) {
iterator_base first(iterator_base(bucket, it));
- iterator_base second(iterator_base(bucket, this->last_in_group(it)));
- second.increment();
+ iterator_base second(first);
+ second.incrementGroup();
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