From 240f5f94b1bc27efd73722f2d80bc88a4722a7b5 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 25 Mar 2023 12:31:49 +0100 Subject: [PATCH] moved erase_if_impl from foa::table_core into foa::table --- include/boost/unordered/detail/foa/core.hpp | 10 ---------- include/boost/unordered/detail/foa/table.hpp | 11 +++++++++-- 2 files changed, 9 insertions(+), 12 deletions(-) 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: