Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80383 - trunk/boost/unordered/detail
From: dnljms_at_[hidden]
Date: 2012-09-03 16:03:35


Author: danieljames
Date: 2012-09-03 16:03:35 EDT (Mon, 03 Sep 2012)
New Revision: 80383
URL: http://svn.boost.org/trac/boost/changeset/80383

Log:
Unordered: Use node_holder for move.
Text files modified:
   trunk/boost/unordered/detail/buckets.hpp | 7 +++++++
   trunk/boost/unordered/detail/table.hpp | 11 ++++-------
   2 files changed, 11 insertions(+), 7 deletions(-)

Modified: trunk/boost/unordered/detail/buckets.hpp
==============================================================================
--- trunk/boost/unordered/detail/buckets.hpp (original)
+++ trunk/boost/unordered/detail/buckets.hpp 2012-09-03 16:03:35 EDT (Mon, 03 Sep 2012)
@@ -443,6 +443,8 @@
         typedef typename node_allocator_traits::pointer node_pointer;
         typedef typename node::value_type value_type;
         typedef typename node::link_pointer link_pointer;
+ typedef boost::unordered::iterator_detail::
+ iterator<node_pointer, value_type> iterator;
 
         node_pointer nodes_;
 
@@ -514,6 +516,11 @@
                 return base::release();
             }
         }
+
+ iterator get_start() const
+ {
+ return iterator(nodes_);
+ }
     };
 
     template <typename Alloc>

Modified: trunk/boost/unordered/detail/table.hpp
==============================================================================
--- trunk/boost/unordered/detail/table.hpp (original)
+++ trunk/boost/unordered/detail/table.hpp 2012-09-03 16:03:35 EDT (Mon, 03 Sep 2012)
@@ -255,7 +255,7 @@
         // TODO: Why not calculate_max_load?
         // TODO: Why do I use x's bucket count?
         table(table& x, node_allocator const& a,
- boost::unordered::detail::move_tag m) :
+ boost::unordered::detail::move_tag) :
             buckets(a, x.bucket_count_),
             functions(x),
             mlf_(x.mlf_),
@@ -265,14 +265,11 @@
                 this->move_buckets_from(x);
             }
             else if(x.size_) {
- // Use a temporary table because moving the nodes leaves the
- // source container in a complete mess.
-
- buckets tmp(x, m);
-
                 this->create_buckets(this->bucket_count_);
+
                 move_nodes<node_allocator> move(this->node_alloc());
- table_impl::fill_buckets(tmp.get_start(), *this, move);
+ node_holder<node_allocator> nodes(x);
+ table_impl::fill_buckets(nodes.get_start(), *this, move);
 
                 this->max_load_ = calculate_max_load();
             }


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