Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349178 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/unordered_set b/include/unordered_set
index 25b9220..b4e61da 100644
--- a/include/unordered_set
+++ b/include/unordered_set
@@ -339,6 +339,13 @@
               unordered_multiset<Value, Hash, Pred, Alloc>& y)
               noexcept(noexcept(x.swap(y)));
 
+template <class K, class T, class H, class P, class A, class Predicate>
+    void erase_if(unordered_set<K, T, H, P, A>& c, Predicate pred);       // C++20
+
+template <class K, class T, class H, class P, class A, class Predicate>
+    void erase_if(unordered_multiset<K, T, H, P, A>& c, Predicate pred);  // C++20
+
+
 template <class Value, class Hash, class Pred, class Alloc>
     bool
     operator==(const unordered_multiset<Value, Hash, Pred, Alloc>& x,
@@ -934,6 +941,13 @@
     __x.swap(__y);
 }
 
+#if _LIBCPP_STD_VER > 17
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+void erase_if(unordered_set<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred)
+{ __libcpp_erase_if_container(__c, __pred); }
+#endif
+
 template <class _Value, class _Hash, class _Pred, class _Alloc>
 bool
 operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
@@ -1497,6 +1511,13 @@
     __x.swap(__y);
 }
 
+#if _LIBCPP_STD_VER > 17
+template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate>
+inline _LIBCPP_INLINE_VISIBILITY
+void erase_if(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __c, _Predicate __pred)
+{ __libcpp_erase_if_container(__c, __pred); }
+#endif
+
 template <class _Value, class _Hash, class _Pred, class _Alloc>
 bool
 operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,