Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80562 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2012-09-17 14:59:30


Author: danieljames
Date: 2012-09-17 14:59:29 EDT (Mon, 17 Sep 2012)
New Revision: 80562
URL: http://svn.boost.org/trac/boost/changeset/80562

Log:
Unordered: Support empty containers in node_holder.
Text files modified:
   trunk/boost/unordered/detail/buckets.hpp | 12 +++++++-----
   trunk/boost/unordered/detail/table.hpp | 9 +++------
   2 files changed, 10 insertions(+), 11 deletions(-)

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2012-09-17 14:59:29 EDT (Mon, 17 Sep 2012)
@@ -444,10 +444,12 @@
             base(b.node_alloc()),
             nodes_()
         {
- typename Table::previous_pointer prev = b.get_previous_start();
- nodes_ = static_cast<node_pointer>(prev->next_);
- prev->next_ = link_pointer();
- b.size_ = 0;
+ if (b.size_) {
+ typename Table::previous_pointer prev = b.get_previous_start();
+ nodes_ = static_cast<node_pointer>(prev->next_);
+ prev->next_ = link_pointer();
+ b.size_ = 0;
+ }
         }
 
         ~node_holder();
@@ -508,7 +510,7 @@
             }
         }
 
- iterator get_start() const
+ iterator begin() const
         {
             return iterator(nodes_);
         }

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2012-09-17 14:59:29 EDT (Mon, 17 Sep 2012)
@@ -400,7 +400,7 @@
 
                 move_nodes<node_allocator> move(node_alloc());
                 node_holder<node_allocator> nodes(x);
- table_impl::fill_buckets(nodes.get_start(), *this, move);
+ table_impl::fill_buckets(nodes.begin(), *this, move);
             }
         }
 
@@ -765,11 +765,8 @@
                 // elements, assigning to them if possible, and deleting
                 // any that are left over.
                 move_assign_nodes<table> assign(*this);
-
- if (x.size_) {
- node_holder<node_allocator> nodes(x);
- table_impl::fill_buckets(nodes.get_start(), *this, assign);
- }
+ node_holder<node_allocator> nodes(x);
+ table_impl::fill_buckets(nodes.begin(), *this, assign);
             }
         }
         


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