================
@@ -60,12 +61,12 @@ template <class S1Ty, class S2Ty> void set_intersect(S1Ty 
&S1, const S2Ty &S2) {
   if constexpr (detail::HasMemberRemoveIf<S1Ty, decltype(Pred)>) {
     S1.remove_if(Pred);
   } else {
-    typename S1Ty::iterator Next;
-    for (typename S1Ty::iterator I = S1.begin(); I != S1.end(); I = Next) {
-      Next = std::next(I);
-      if (!S2.count(*I))
-        S1.erase(I); // Erase element if not in S2
-    }
+    SmallVector<typename S1Ty::value_type> ToRemove;
+    for (const auto &E : S1)
+      if (!S2.count(E))
+        ToRemove.push_back(E);
+    for (const auto &E : ToRemove)
+      S1.erase(E);
----------------
MaskRay wrote:

`if constexpr (HasMemberRemoveIf) branch (L60-61)`  utilizes the added 
`remove_if`. This chunk has been reverted

https://github.com/llvm/llvm-project/pull/198982
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to