================
@@ -0,0 +1,89 @@
+// RUN: %check_clang_tidy -std=c++20 %s modernize-use-std-erase %t
+#include <deque>
+#include <list>
+#include <string>
+#include <vector>
+
+namespace std {
+template <class ForwardIt, class T>
+ForwardIt remove(ForwardIt first, ForwardIt last, const T& value);
+
+template <class ForwardIt, class UnaryPredicate>
+ForwardIt remove_if(ForwardIt first, ForwardIt last, UnaryPredicate p);
+
+// Dummy implementation
+template <class ForwardIt, class UnaryPredicate>
+ForwardIt remove_if(ForwardIt first, ForwardIt last, UnaryPredicate p) {
+  return first;
+}
+
+} // namespace std
+
+// Custom container - should be ignored
+template <typename T>
+struct MyContainer {
+  using iterator = T*;
+  iterator begin();
+  iterator end();
+  iterator erase(iterator, iterator);
+};
+
+void test_standard_remove_idiom() {
+  std::vector<int> v;
----------------
vbvictor wrote:

Add test with

```cpp
template <typename T> foo(std::vector<T> v) {
  v.erase(...)
}
```

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

Reply via email to