diff --git a/include/momo/HashMap.h b/include/momo/HashMap.h index f7244d0a..d809bdd5 100644 --- a/include/momo/HashMap.h +++ b/include/momo/HashMap.h @@ -794,13 +794,13 @@ class HashMap return mHashSet.Remove(key); } - template - internal::EnableIf::value, - size_t> Remove(const PairPredicate& pairPred) + template + internal::EnableIf::value, + size_t> Remove(const PairFilter& pairFilter) { - auto itemPred = [&pairPred] (const KeyValuePair& item) - { return pairPred(*item.GetKeyPtr(), *static_cast(item.GetValuePtr())); }; - return mHashSet.Remove(itemPred); + auto itemFilter = [&pairFilter] (const KeyValuePair& item) + { return pairFilter(*item.GetKeyPtr(), *static_cast(item.GetValuePtr())); }; + return mHashSet.Remove(itemFilter); } ExtractedPair Extract(ConstPosition pos) diff --git a/include/momo/HashMultiMap.h b/include/momo/HashMultiMap.h index a5850d87..1c2f2ba3 100644 --- a/include/momo/HashMultiMap.h +++ b/include/momo/HashMultiMap.h @@ -1063,15 +1063,15 @@ class HashMultiMap return pvMakeIterator(KeyIteratorProxy(hashMapIter), valueIndex, true); } - template - internal::EnableIf::value, - size_t> Remove(const PairPredicate& pairPred) + template + internal::EnableIf::value, + size_t> Remove(const PairFilter& pairFilter) { size_t initValueCount = mValueCount; Iterator iter = GetBegin(); while (!!iter) { - if (pairPred(iter->key, static_cast(iter->value))) + if (pairFilter(iter->key, static_cast(iter->value))) iter = Remove(iter); else ++iter; diff --git a/include/momo/HashSet.h b/include/momo/HashSet.h index aae27a40..adfabf2a 100644 --- a/include/momo/HashSet.h +++ b/include/momo/HashSet.h @@ -873,15 +873,15 @@ class HashSet return true; } - template - internal::EnableIf::value, - size_t> Remove(const Predicate& pred) + template + internal::EnableIf::value, + size_t> Remove(const ItemFilter& itemFilter) { size_t initCount = GetCount(); ConstIterator iter = GetBegin(); while (!!iter) { - if (pred(*iter)) + if (itemFilter(*iter)) iter = Remove(iter); else ++iter; diff --git a/include/momo/TreeMap.h b/include/momo/TreeMap.h index 5f292d0a..11a6a2bb 100644 --- a/include/momo/TreeMap.h +++ b/include/momo/TreeMap.h @@ -712,13 +712,13 @@ class TreeMap return mTreeSet.Remove(key); } - template - internal::EnableIf::value, - size_t> Remove(const PairPredicate& pairPred) + template + internal::EnableIf::value, + size_t> Remove(const PairFilter& pairFilter) { - auto itemPred = [&pairPred] (const KeyValuePair& item) - { return pairPred(*item.GetKeyPtr(), *static_cast(item.GetValuePtr())); }; - return mTreeSet.Remove(itemPred); + auto itemFilter = [&pairFilter] (const KeyValuePair& item) + { return pairFilter(*item.GetKeyPtr(), *static_cast(item.GetValuePtr())); }; + return mTreeSet.Remove(itemFilter); } ExtractedPair Extract(ConstIterator iter) diff --git a/include/momo/TreeSet.h b/include/momo/TreeSet.h index 7ff0c3d9..75cff47d 100644 --- a/include/momo/TreeSet.h +++ b/include/momo/TreeSet.h @@ -925,15 +925,15 @@ class TreeSet return remCount; } - template - internal::EnableIf::value, - size_t> Remove(const Predicate& pred) + template + internal::EnableIf::value, + size_t> Remove(const ItemFilter& itemFilter) { size_t initCount = GetCount(); ConstIterator iter = GetBegin(); while (iter != GetEnd()) { - if (pred(*iter)) + if (itemFilter(*iter)) iter = Remove(iter); else ++iter; diff --git a/include/momo/stdish/map.h b/include/momo/stdish/map.h index 8f3b0b06..fedcb56b 100644 --- a/include/momo/stdish/map.h +++ b/include/momo/stdish/map.h @@ -958,12 +958,12 @@ class map : public internal::map_base(mappedArg)).first; } - template - friend size_type erase_if(map& cont, const Predicate& pred) + template + friend size_type erase_if(map& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.get_nested_container().Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.get_nested_container().Remove(pairFilter); } private: @@ -1094,12 +1094,12 @@ class multimap : public internal::map_base(valueArgs)...).first; } - template - friend size_type erase_if(multimap& cont, const Predicate& pred) + template + friend size_type erase_if(multimap& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.get_nested_container().Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.get_nested_container().Remove(pairFilter); } }; diff --git a/include/momo/stdish/set.h b/include/momo/stdish/set.h index 74bd2703..ff19365b 100644 --- a/include/momo/stdish/set.h +++ b/include/momo/stdish/set.h @@ -503,10 +503,10 @@ class set return mTreeSet.Remove(key); } - template - friend size_type erase_if(set& cont, const Predicate& pred) + template + friend size_type erase_if(set& cont, const ValueFilter& valueFilter) { - return cont.mTreeSet.Remove(pred); + return cont.mTreeSet.Remove(valueFilter); } node_type extract(const_iterator where) @@ -662,10 +662,10 @@ class multiset : public set return Set::emplace(std::forward(valueArgs)...).first; } - template - friend size_type erase_if(multiset& cont, const Predicate& pred) + template + friend size_type erase_if(multiset& cont, const ValueFilter& valueFilter) { - return cont.get_nested_container().Remove(pred); + return cont.get_nested_container().Remove(valueFilter); } }; diff --git a/include/momo/stdish/unordered_map.h b/include/momo/stdish/unordered_map.h index 1d190f3a..a622cc4b 100644 --- a/include/momo/stdish/unordered_map.h +++ b/include/momo/stdish/unordered_map.h @@ -650,12 +650,12 @@ class unordered_map return mHashMap.Remove(key) ? 1 : 0; } - template - friend size_type erase_if(unordered_map& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_map& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.mHashMap.Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.mHashMap.Remove(pairFilter); } MOMO_FORCEINLINE typename HashMap::ValueReferenceRKey operator[](key_type&& key) @@ -1022,12 +1022,12 @@ class unordered_map_open : public unordered_map - friend size_type erase_if(unordered_map_open& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_map_open& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.get_nested_container().Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.get_nested_container().Remove(pairFilter); } }; diff --git a/include/momo/stdish/unordered_multimap.h b/include/momo/stdish/unordered_multimap.h index a3a23bb9..614f8c67 100644 --- a/include/momo/stdish/unordered_multimap.h +++ b/include/momo/stdish/unordered_multimap.h @@ -593,12 +593,12 @@ class unordered_multimap return mHashMultiMap.RemoveKey(key); } - template - friend size_type erase_if(unordered_multimap& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_multimap& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.mHashMultiMap.Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.mHashMultiMap.Remove(pairFilter); } //iterator insert(node_type&& node) @@ -776,12 +776,12 @@ class unordered_multimap_open : public unordered_multimap - friend size_type erase_if(unordered_multimap_open& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_multimap_open& cont, const ValueFilter& valueFilter) { - auto pairPred = [&pred] (const key_type& key, const mapped_type& mapped) - { return pred(const_reference(key, mapped)); }; - return cont.get_nested_container().Remove(pairPred); + auto pairFilter = [&valueFilter] (const key_type& key, const mapped_type& mapped) + { return valueFilter(const_reference(key, mapped)); }; + return cont.get_nested_container().Remove(pairFilter); } }; diff --git a/include/momo/stdish/unordered_set.h b/include/momo/stdish/unordered_set.h index 051461ee..d343e4d8 100644 --- a/include/momo/stdish/unordered_set.h +++ b/include/momo/stdish/unordered_set.h @@ -529,10 +529,10 @@ class unordered_set return mHashSet.Remove(key) ? 1 : 0; } - template - friend size_type erase_if(unordered_set& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_set& cont, const ValueFilter& valueFilter) { - return cont.mHashSet.Remove(pred); + return cont.mHashSet.Remove(valueFilter); } node_type extract(const_iterator where) @@ -698,10 +698,10 @@ class unordered_set_open : public unordered_set - friend size_type erase_if(unordered_set_open& cont, const Predicate& pred) + template + friend size_type erase_if(unordered_set_open& cont, const ValueFilter& valueFilter) { - return cont.get_nested_container().Remove(pred); + return cont.get_nested_container().Remove(valueFilter); } };