void move_assign(table& x, false_type) { if (node_alloc() == x.node_alloc()) { delete_buckets(); set_hash_functions new_func_this(*this, x); // No throw from here. mlf_ = x.mlf_; max_load_ = x.max_load_; move_buckets_from(x); new_func_this.commit(); } else { set_hash_functions new_func_this(*this, x); new_func_this.commit(); mlf_ = x.mlf_; recalculate_max_load(); if (!size_ && !x.size_) return; if (x.size_ >= max_load_) { create_buckets(min_buckets_for_size(x.size_)); } else { clear_buckets(); } static_cast<table_impl*>(this)->move_assign_buckets(x); } }
void assign(table const& x, true_type) { if (node_alloc() == x.node_alloc()) { allocators_.assign(x.allocators_); assign(x, false_type()); } else { set_hash_functions new_func_this(*this, x); // Delete everything with current allocators before assigning // the new ones. delete_buckets(); allocators_.assign(x.allocators_); // Copy over other data, all no throw. new_func_this.commit(); mlf_ = x.mlf_; bucket_count_ = min_buckets_for_size(x.size_); max_load_ = 0; // Finally copy the elements. if (x.size_) { static_cast<table_impl*>(this)->copy_buckets(x); } } }
void swap_allocators(table& other, false_type) { boost::unordered::detail::func::ignore_unused_variable_warning(other); // According to 23.2.1.8, if propagate_on_container_swap is // false the behaviour is undefined unless the allocators // are equal. BOOST_ASSERT(node_alloc() == other.node_alloc()); }
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<table_impl*>(this)->move_buckets(x); } }