summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-11 18:42:02 +0000
committerChris Lattner <sabre@nondot.org>2008-01-11 18:42:02 +0000
commitc70ed4ba5b50c9a389c6c16d8543afa7198f69c5 (patch)
tree4b9c262257bbedde4dec249a0d6a3a5957d3f59e /llvm
parent596875118cb124f3a7ab9bb70473a5683b34758c (diff)
downloadbcm5719-llvm-c70ed4ba5b50c9a389c6c16d8543afa7198f69c5.tar.gz
bcm5719-llvm-c70ed4ba5b50c9a389c6c16d8543afa7198f69c5.zip
add operator==/!= to smallvector.
llvm-svn: 45872
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/SmallVector.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 5496d7acbf7..a6b65dd58b4 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.
OpenPOWER on IntegriCloud