diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index c893d5bc..fd413805 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -1602,14 +1602,15 @@ private: /* slot wasn't empty */ goto startover; } + auto p=this->arrays.elements()+pos*N+n; + this->construct_element(p,std::forward(args)...); if(BOOST_UNLIKELY( !insert_counter(pos0).compare_exchange_weak(counter,counter+1))){ /* other thread inserted from pos0, need to start over */ + this->destroy_element(p); pg->reset(n); goto startover; } - auto p=this->arrays.elements()+pos*N+n; - this->construct_element(p,std::forward(args)...); pg->set(n,hash); insert_counter(pos0)=counter+2; ++local_garbage_vector().size;