diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index ed0f8c32..599ec1c7 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -2853,26 +2853,6 @@ struct table : boost::unordered::detail::functions(this)->copy_buckets(x); - } - } - - void move_init(table& x) - { - if (node_alloc() == x.node_alloc()) { - move_buckets_from(x); - } else if (x.size_) { - // TODO: Could pick new bucket size? - static_cast(this)->move_buckets(x); - } - } - //////////////////////////////////////////////////////////////////////// // Clear buckets and Create buckets // @@ -3749,24 +3729,34 @@ struct table_unique : boost::unordered::detail::table : table(x, node_allocator_traits::select_on_container_copy_construction( x.node_alloc())) { - this->init(x); + if (x.size_) { + this->copy_buckets(x); + } } table_unique(table_unique const& x, node_allocator const& a) : table(x, a) { - this->init(x); + if (x.size_) { + this->copy_buckets(x); + } } table_unique(table_unique& x, boost::unordered::detail::move_tag m) : table(x, m) { + // The move is done in the base class. } table_unique(table_unique& x, node_allocator const& a, boost::unordered::detail::move_tag m) : table(x, a, m) { - this->move_init(x); + if (this->node_alloc() == x.node_alloc()) { + this->move_buckets_from(x); + } else if (x.size_) { + // TODO: Could pick new bucket size? + this->move_buckets(x); + } } // Accessors @@ -4461,24 +4451,34 @@ struct table_equiv : boost::unordered::detail::table : table(x, node_allocator_traits::select_on_container_copy_construction( x.node_alloc())) { - this->init(x); + if (x.size_) { + copy_buckets(x); + } } table_equiv(table_equiv const& x, node_allocator const& a) : table(x, a) { - this->init(x); + if (x.size_) { + copy_buckets(x); + } } table_equiv(table_equiv& x, boost::unordered::detail::move_tag m) : table(x, m) { + // The move is done in the base class. } table_equiv(table_equiv& x, node_allocator const& a, boost::unordered::detail::move_tag m) : table(x, a, m) { - this->move_init(x); + if (this->node_alloc() == x.node_alloc()) { + this->move_buckets_from(x); + } else if (x.size_) { + // TODO: Could pick new bucket size? + this->move_buckets(x); + } } // Equality