[llvm-commits] [llvm] r45872 - /llvm/trunk/include/llvm/ADT/SmallVector.h
Chris Lattner
sabre at nondot.org
Fri Jan 11 10:42:02 PST 2008
Author: lattner
Date: Fri Jan 11 12:42:02 2008
New Revision: 45872
URL: http://llvm.org/viewvc/llvm-project?rev=45872&view=rev
Log:
add operator==/!= to smallvector.
Modified:
llvm/trunk/include/llvm/ADT/SmallVector.h
Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=45872&r1=45871&r2=45872&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Fri Jan 11 12:42:02 2008
@@ -294,6 +294,16 @@
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.
More information about the llvm-commits
mailing list