From a356c67c384aec81c9326334c6d3798fb6e13daf Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 18 Dec 2007 23:50:29 +0000 Subject: [PATCH] Pull another node_constructor out of a loop. [SVN r42159] --- include/boost/unordered/detail/hash_table_impl.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/unordered/detail/hash_table_impl.hpp b/include/boost/unordered/detail/hash_table_impl.hpp index 6c355244..26152520 100644 --- a/include/boost/unordered/detail/hash_table_impl.hpp +++ b/include/boost/unordered/detail/hash_table_impl.hpp @@ -1718,8 +1718,8 @@ namespace boost { template void insert(InputIterator i, InputIterator j) { - // If only inserting 1 element, get the required - // safety since insert is only called once. + node_constructor a(this->allocators_); + for (; i != j; ++i) { // No side effects in this initial code size_type hash_value = hash_function()(extract_key(*i)); @@ -1733,7 +1733,6 @@ namespace boost { // Create the node before rehashing in case it throws an // exception (need strong safety in such a case). - node_constructor a(this->allocators_); value_type const& v = *i; a.construct(v);