[llvm-branch-commits] [llvm] [ADT] Use range-based helper functions in SmallSet (PR #108585)

David Blaikie via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Sep 18 11:58:32 PDT 2024


================
@@ -234,19 +225,12 @@ class SmallSet {
   /// Check if the SmallSet contains the given element.
   bool contains(const T &V) const {
     if (isSmall())
-      return vfind(V) != Vector.end();
-    return Set.find(V) != Set.end();
+      return llvm::is_contained(Vector, V);
+    return llvm::is_contained(Set, V);
----------------
dwblaikie wrote:

FWIW, I think is_contained is more legible than find!=end and seems fine to use here & I agree with the comment on is_contained suggesting it for uses like this.

https://github.com/llvm/llvm-project/pull/108585


More information about the llvm-branch-commits mailing list