From c70ed4ba5b50c9a389c6c16d8543afa7198f69c5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 11 Jan 2008 18:42:02 +0000 Subject: [PATCH] add operator==/!= to smallvector. llvm-svn: 45872 --- llvm/include/llvm/ADT/SmallVector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 5496d7acbf71..a6b65dd58b41 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/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.