From 3541003208e47f3acc122013bc4e0aa7140c9a1d 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 llvm-svn: 34137 --- llvm/include/llvm/ADT/DenseMap.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index 7e8b8c5e02f2..83edd640e334 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/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;