diff --git a/include/boost/unordered/detail/foa/core.hpp b/include/boost/unordered/detail/foa/core.hpp index f70b75dc..79d8313d 100644 --- a/include/boost/unordered/detail/foa/core.hpp +++ b/include/boost/unordered/detail/foa/core.hpp @@ -1616,16 +1616,6 @@ public: return it; } - template - std::size_t erase_if_impl(Predicate&& pr) - { - std::size_t s=size(); - for_all_elements([&,this](group_type* pg,unsigned int n,element_type* p){ - if(pr(type_policy::value_from(*p))) erase(pg,n,p); - }); - return std::size_t(s-size()); - } - template void for_all_elements(F f)const { diff --git a/include/boost/unordered/detail/foa/table.hpp b/include/boost/unordered/detail/foa/table.hpp index 1cc23154..4ac77d26 100644 --- a/include/boost/unordered/detail/foa/table.hpp +++ b/include/boost/unordered/detail/foa/table.hpp @@ -420,9 +420,16 @@ public: using super::reserve; template - friend std::size_t erase_if(table& x,Predicate pr) + friend std::size_t erase_if(table& x,Predicate&& pr) { - return x.erase_if_impl(pr); + std::size_t s=size(); + this->for_all_elements( + [&,this](group_type* pg,unsigned int n,element_type* p){ + if(pr(const_cast(type_policy::value_from(*p))){ + this->erase(pg,n,p); + } + }); + return std::size_t(s-size()); } private: