summaryrefslogtreecommitdiff
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-10-09 23:02:47 +0000
committerDouglas Gregor <dgregor@apple.com>2012-10-09 23:02:47 +0000
commit8161d81239f1d125cb1aeaf0be6916c36d4cdf2f (patch)
treee71e354884b3adf49b9d1267d6f2b9d96c8fd63e /include/llvm/ADT
parent63b8ab29c420703dc5ef32e6d76d9e4d8f60f19e (diff)
downloadllvm-8161d81239f1d125cb1aeaf0be6916c36d4cdf2f.tar.gz
llvm-8161d81239f1d125cb1aeaf0be6916c36d4cdf2f.tar.bz2
llvm-8161d81239f1d125cb1aeaf0be6916c36d4cdf2f.tar.xz
Add count() method to MapVector
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165559 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/MapVector.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/llvm/ADT/MapVector.h b/include/llvm/ADT/MapVector.h
index 3f7a596413..6aacca5a6f 100644
--- a/include/llvm/ADT/MapVector.h
+++ b/include/llvm/ADT/MapVector.h
@@ -78,6 +78,11 @@ public:
}
return Vector[I].second;
}
+
+ unsigned count(const KeyT &Key) const {
+ typename MapType::const_iterator Pos = Map.find(Key);
+ return Pos == Map.end()? 0 : 1;
+ }
};
}