diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-11 18:42:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-11 18:42:02 +0000 |
commit | 8874628e30a327afe91648c84bfa1e2dd13f0dba (patch) | |
tree | 3706f7c5bea77a927dcbd32db55c7f1bbdd2d3fd /include/llvm | |
parent | 5080f4d9919d39b367891dc51e739c571a66036c (diff) | |
download | external_llvm-8874628e30a327afe91648c84bfa1e2dd13f0dba.zip external_llvm-8874628e30a327afe91648c84bfa1e2dd13f0dba.tar.gz external_llvm-8874628e30a327afe91648c84bfa1e2dd13f0dba.tar.bz2 |
add operator==/!= to smallvector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/SmallVector.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index 5496d7a..a6b65dd 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -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. |