diff --git a/include/boost/unordered/detail/buckets.hpp b/include/boost/unordered/detail/buckets.hpp index c4c18cfe..a72b9568 100644 --- a/include/boost/unordered/detail/buckets.hpp +++ b/include/boost/unordered/detail/buckets.hpp @@ -443,6 +443,8 @@ namespace boost { namespace unordered { namespace detail { 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 iterator; node_pointer nodes_; @@ -514,6 +516,11 @@ namespace boost { namespace unordered { namespace detail { return base::release(); } } + + iterator get_start() const + { + return iterator(nodes_); + } }; template diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 19663f48..24035a8a 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -255,7 +255,7 @@ namespace boost { namespace unordered { namespace detail { // 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 @@ namespace boost { namespace unordered { namespace detail { 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 move(this->node_alloc()); - table_impl::fill_buckets(tmp.get_start(), *this, move); + node_holder nodes(x); + table_impl::fill_buckets(nodes.get_start(), *this, move); this->max_load_ = calculate_max_load(); }