diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index a48ed984..53d48958 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -127,8 +127,8 @@ struct atomic_integral { operator Integral()const{return n.load(std::memory_order_acquire);} void operator=(Integral m){n.store(m,std::memory_order_release);} - void operator|=(Integral m){n.fetch_or(m,std::memory_order_acq_rel);} - void operator&=(Integral m){n.fetch_and(m,std::memory_order_acq_rel);} + void operator|=(Integral m){n.fetch_or(m,std::memory_order_release);} + void operator&=(Integral m){n.fetch_and(m,std::memory_order_release);} std::atomic n; }; @@ -295,7 +295,8 @@ public: BOOST_FORCEINLINE bool try_emplace_or_visit(Key&& x,F f,Args&&... args) { return emplace_or_visit_impl( - f,try_emplace_args_t{},std::forward(x),std::forward(args)...); + std::forward(f), + try_emplace_args_t{},std::forward(x),std::forward(args)...); } template @@ -313,21 +314,21 @@ public: template BOOST_FORCEINLINE bool insert_or_visit(const init_type& x,F f) - {return emplace_or_visit_impl(x,std::forward(f));} + {return emplace_or_visit_impl(std::forward(f),x);} template BOOST_FORCEINLINE bool insert_or_visit(init_type&& x,F f) - {return emplace_or_visit_impl(std::move(x),std::forward(f));} + {return emplace_or_visit_impl(std::forward(f),std::move(x));} /* typename=void tilts call ambiguities in favor of init_type */ template BOOST_FORCEINLINE bool insert_or_visit(const value_type& x,F f) - {return emplace_or_visit_impl(x,std::forward(f));} + {return emplace_or_visit_impl(std::forward(f),x);} template BOOST_FORCEINLINE bool insert_or_visit(value_type&& x,F f) - {return emplace_or_visit_impl(std::move(x),std::forward(f));} + {return emplace_or_visit_impl(std::forward(f),std::move(x));} template BOOST_FORCEINLINE std::size_t erase_if(Key&& x,F f) @@ -690,7 +691,8 @@ private: { auto lck=exclusive_access(); // TODO: use same mechanism as unchecked_emplace_with_rehash - if(this->size_==this->ml)this->super::rehash(super::capacity()+1); + //if(this->size_>=this->ml/2)super::rehash(super::capacity()+1); + super::rehash(super::capacity()+1); } shared_lock_guard shared_access()const