add operator==/!= to smallvector.
authorChris Lattner <sabre@nondot.org>
Fri, 11 Jan 2008 18:42:02 +0000 (18:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Jan 2008 18:42:02 +0000 (18:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45872 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/SmallVector.h

index 5496d7acbf71a1f2778721351457b520f970212a..a6b65dd58b410ae70bf4f01a68c70efac0a98bea 100644 (file)
@@ -294,6 +294,16 @@ public:
   
   const SmallVectorImpl &operator=(const SmallVectorImpl &RHS);
   
+  bool operator==(const SmallVectorImpl &RHS) const {
+    if (size() != RHS.size()) return false;
+    for (T *This = Begin, *That = RHS.Begin, *End = Begin+size(); 
+         This != End; ++This, ++That)
+      if (*This != *That)
+        return false;
+    return true;
+  }
+  bool operator!=(const SmallVectorImpl &RHS) const { return !(*this == RHS); }
+  
 private:
   /// isSmall - Return true if this is a smallvector which has not had dynamic
   /// memory allocated for it.