forked from boostorg/unordered
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:
1 parent
1d4845d6b8
commit
b4a3c6f460
6 files changed
+91
-60
No files matched your search
@@ -311,7 +311,13 @@ namespace boost { namespace unordered { namespace detail {
|
||||
node_constructor& a,
|
||||
std::size_t key_hash)
|
||||
{
|
||||
node_pointer n = a.release();
|
||||
return add_node(a.release(), key_hash);
|
||||
}
|
||||
|
||||
inline iterator add_node(
|
||||
node_pointer n,
|
||||
std::size_t key_hash)
|
||||
{
|
||||
n->hash_ = key_hash;
|
||||
|
||||
bucket_pointer b = this->get_bucket(this->hash_to_bucket(key_hash));
|
||||
@@ -577,19 +583,10 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// fill_buckets
|
||||
|
||||
template <class NodeCreator>
|
||||
static void fill_buckets(iterator n, table& dst,
|
||||
NodeCreator& creator)
|
||||
void fill_buckets(iterator n, NodeCreator& creator)
|
||||
{
|
||||
link_pointer prev = dst.get_previous_start();
|
||||
|
||||
while (n.node_) {
|
||||
node_pointer node = creator.create(*n);
|
||||
node->hash_ = n.node_->hash_;
|
||||
prev->next_ = node;
|
||||
++dst.size_;
|
||||
++n;
|
||||
|
||||
prev = place_in_bucket(dst, prev);
|
||||
for (; n.node_; ++n) {
|
||||
this->add_node(creator.create(*n), n.node_->hash_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user