Fix exception safety in assignment for multimap/multiset.

The assignment code seemed like a bit of a premature optimization, I
replaced it with a slightly slower but much simpler implementation.
This commit is contained in:
Daniel James
2016-05-30 11:29:20 +01:00
parent 1d4845d6b8
commit b4a3c6f460
6 changed files with 91 additions and 60 deletions

View File

@@ -393,7 +393,7 @@ namespace boost { namespace unordered { namespace detail {
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> node_creator(node_alloc());
table_impl::fill_buckets(x.begin(), *this, node_creator);
static_cast<table_impl*>(this)->fill_buckets(x.begin(), node_creator);
}
}
@@ -408,7 +408,7 @@ namespace boost { namespace unordered { namespace detail {
move_nodes<node_allocator> node_creator(node_alloc());
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
static_cast<table_impl*>(this)->fill_buckets(nodes.begin(), node_creator);
}
}
@@ -654,7 +654,7 @@ namespace boost { namespace unordered { namespace detail {
// assigning to them if possible, and deleting any that are
// left over.
assign_nodes<table> node_creator(*this);
table_impl::fill_buckets(x.begin(), *this, node_creator);
static_cast<table_impl*>(this)->fill_buckets(x.begin(), node_creator);
}
void assign(table const& x, true_type)
@@ -681,7 +681,7 @@ namespace boost { namespace unordered { namespace detail {
if (x.size_) {
create_buckets(bucket_count_);
copy_nodes<node_allocator> node_creator(node_alloc());
table_impl::fill_buckets(x.begin(), *this, node_creator);
static_cast<table_impl*>(this)->fill_buckets(x.begin(), node_creator);
}
}
}
@@ -740,7 +740,7 @@ namespace boost { namespace unordered { namespace detail {
// any that are left over.
move_assign_nodes<table> node_creator(*this);
node_holder<node_allocator> nodes(x);
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
static_cast<table_impl*>(this)->fill_buckets(nodes.begin(), node_creator);
}
}