forked from OSchip/llvm-project
Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node. llvm-svn: 46034
This commit is contained in:
parent
41f375a45c
commit
7ea05687be
|
@ -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.
|
||||
//===--------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue