diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-08-29 00:48:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-29 00:48:44 +0000 |
commit | 7b75fbf224c0a2d181c35708a27c514ae798c904 (patch) | |
tree | 407aa7c3d8688253f3754c416749f3cf923897e4 /include/llvm | |
parent | 4d46d0af583b95a5d4f7d490f542c4fb65b9e824 (diff) | |
download | external_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.tar.gz external_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.tar.bz2 external_llvm-7b75fbf224c0a2d181c35708a27c514ae798c904.zip |
Add DenseMap::lookup:
/// lookup - Return the entry for the specified key, or a default
/// constructed value if no such entry exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/DenseMap.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index df8f464ada..70d09a6617 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -189,6 +189,15 @@ public: 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)) |