From 569b935e6b23c4a0e4ebb2c96603974310ef0587 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 10 Feb 2007 06:58:17 +0000 Subject: [PATCH] Make find return the appropriate iterator/const_iterator git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34137 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/DenseMap.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index 7e8b8c5e02f..83edd640e33 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -108,12 +108,18 @@ public: return LookupBucketFor(Val, TheBucket); } - iterator find(const KeyT &Val) const { + iterator find(const KeyT &Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) return iterator(TheBucket, Buckets+NumBuckets); return end(); } + const_iterator find(const KeyT &Val) const { + BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return const_iterator(TheBucket, Buckets+NumBuckets); + return end(); + } bool insert(const std::pair &KV) { BucketT *TheBucket; @@ -334,7 +340,7 @@ class DenseMapConstIterator : public DenseMapIterator { public: DenseMapConstIterator(const std::pair *Pos, const std::pair *E) - : DenseMapIterator(Pos, E) { + : DenseMapIterator(Pos, E) { } const std::pair &operator*() const { return *this->Ptr;