Changed ImmutableMap::find to return an iterator instead of a pointer

to the tree node.

llvm-svn: 46034
This commit is contained in:
Ted Kremenek 2008-01-15 23:53:53 +00:00
parent 41f375a45c
commit 7ea05687be
1 changed files with 11 additions and 10 deletions

View File

@ -98,15 +98,7 @@ public:
bool contains(key_type_ref K) const {
return Root ? Root->contains(K) : false;
}
data_type* find(key_type_ref K) const {
if (Root) {
TreeTy* T = Root->find(K);
if (T) return &T->getValue().second;
}
return NULL;
}
bool operator==(ImmutableMap RHS) const {
return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root;
@ -171,7 +163,7 @@ public:
iterator() {}
iterator(TreeTy* t) : itr(t) {}
friend class ImmutableSet<ValT,ValInfo>;
friend class ImmutableMap;
public:
inline value_type_ref operator*() const { return itr->getValue(); }
@ -189,6 +181,15 @@ public:
iterator begin() const { return iterator(Root); }
iterator end() const { return iterator(); }
iterator find(key_type_ref K) const {
if (Root) {
TreeTy* T = Root->find(K);
if (T) return iterator(T);
}
return iterator();
}
//===--------------------------------------------------===//
// Utility methods.
//===--------------------------------------------------===//