[llvm-commits] [llvm] r55523 - /llvm/trunk/include/llvm/ADT/DenseMap.h
Daniel Dunbar
daniel at zuster.org
Thu Aug 28 17:48:45 PDT 2008
Author: ddunbar
Date: Thu Aug 28 19:48:44 2008
New Revision: 55523
URL: http://llvm.org/viewvc/llvm-project?rev=55523&view=rev
Log:
Add DenseMap::lookup:
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
Modified:
llvm/trunk/include/llvm/ADT/DenseMap.h
Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=55523&r1=55522&r2=55523&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Thu Aug 28 19:48:44 2008
@@ -189,6 +189,15 @@
return end();
}
+ /// lookup - Return the entry for the specified key, or a default
+ /// constructed value if no such entry exists.
+ ValueT lookup(const KeyT &Val) const {
+ BucketT *TheBucket;
+ if (LookupBucketFor(Val, TheBucket))
+ return TheBucket->second;
+ return ValueT();
+ }
+
std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
BucketT *TheBucket;
if (LookupBucketFor(KV.first, TheBucket))
More information about the llvm-commits
mailing list