diff --git a/include/boost/unordered/detail/foa/table.hpp b/include/boost/unordered/detail/foa/table.hpp index 3145a14d..5713ccda 100644 --- a/include/boost/unordered/detail/foa/table.hpp +++ b/include/boost/unordered/detail/foa/table.hpp @@ -422,10 +422,16 @@ public: template friend std::size_t erase_if(table& x,Predicate& pr) { + using value_reference=typename std::conditional< + std::is_same::value, + const_reference, + reference + >::type; + std::size_t s=x.size(); x.for_all_elements( [&](group_type* pg,unsigned int n,element_type* p){ - if(pr(const_cast(type_policy::value_from(*p)))){ + if(pr(const_cast(type_policy::value_from(*p)))){ x.super::erase(pg,n,p); } });