From 863984a7c84843e5c1d7cf2ad421a6abd54c2a81 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 31 Mar 2023 17:28:21 +0200 Subject: [PATCH] fixed erase_if(x,f) return value calculation --- include/boost/unordered/detail/foa/concurrent_table.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index 55ec8519..f3f136e2 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -553,16 +553,19 @@ public: BOOST_FORCEINLINE auto erase_if(Key&& x,F&& f)->typename std::enable_if< !is_execution_policy::value,std::size_t>::type { - auto lck=shared_access(); - auto hash=this->hash_for(x); - return (std::size_t)unprotected_internal_visit( + auto lck=shared_access(); + auto hash=this->hash_for(x); + std::size_t res=0; + unprotected_internal_visit( group_exclusive{},x,this->position_for(hash),hash, [&,this](group_type* pg,unsigned int n,element_type* p) { if(f(cast_for(group_exclusive{},type_policy::value_from(*p)))){ super::erase(pg,n,p); + res=1; } }); + return res; } template