[llvm-branch-commits] [llvm] [ADT] Use range-based helper functions in SmallSet (PR #108585)
Jakub Kuderski via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 13 09:18:35 PDT 2024
================
@@ -206,11 +196,12 @@ class SmallSet {
bool erase(const T &V) {
if (!isSmall())
return Set.erase(V);
- for (mutable_iterator I = Vector.begin(), E = Vector.end(); I != E; ++I)
- if (*I == V) {
- Vector.erase(I);
- return true;
- }
+
+ auto It = llvm::find(Vector, V);
+ if (It != Vector.end()) {
----------------
kuhar wrote:
nit: this is not used outside of the `if`
```suggestion
if (auto It = llvm::find(Vector, V); It != Vector.end()) {
```
https://github.com/llvm/llvm-project/pull/108585
More information about the llvm-branch-commits
mailing list