aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-10 06:58:17 +0000
committerChris Lattner <sabre@nondot.org>2007-02-10 06:58:17 +0000
commit569b935e6b23c4a0e4ebb2c96603974310ef0587 (patch)
treec6b700879b318ba7b137acb760107a3ad4b2203e
parentdc45f0fb40fd95388622022a8f22cb2d904a6d9a (diff)
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
-rw-r--r--include/llvm/ADT/DenseMap.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 7e8b8c5e02..83edd640e3 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<KeyT, ValueT> &KV) {
BucketT *TheBucket;
@@ -334,7 +340,7 @@ class DenseMapConstIterator : public DenseMapIterator<KeyT, ValueT, KeyInfoT> {
public:
DenseMapConstIterator(const std::pair<KeyT, ValueT> *Pos,
const std::pair<KeyT, ValueT> *E)
- : DenseMapIterator<KeyT, ValueT>(Pos, E) {
+ : DenseMapIterator<KeyT, ValueT, KeyInfoT>(Pos, E) {
}
const std::pair<KeyT, ValueT> &operator*() const {
return *this->Ptr;