llvm.org GIT mirror llvm / 316e984
Changed ImmutableMap::find to return an iterator instead of a pointer to the tree node. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46034 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
1 changed file(s) with 11 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
9797 bool contains(key_type_ref K) const {
9898 return Root ? Root->contains(K) : false;
9999 }
100
101 data_type* find(key_type_ref K) const {
102 if (Root) {
103 TreeTy* T = Root->find(K);
104 if (T) return &T->getValue().second;
105 }
106
107 return NULL;
108 }
100
109101
110102 bool operator==(ImmutableMap RHS) const {
111103 return Root && RHS.Root ? Root->isEqual(*RHS.Root) : Root == RHS.Root;
170162
171163 iterator() {}
172164 iterator(TreeTy* t) : itr(t) {}
173 friend class ImmutableSet;
165 friend class ImmutableMap;
174166
175167 public:
176168 inline value_type_ref operator*() const { return itr->getValue(); }
188180 iterator begin() const { return iterator(Root); }
189181 iterator end() const { return iterator(); }
190182
183 iterator find(key_type_ref K) const {
184 if (Root) {
185 TreeTy* T = Root->find(K);
186 if (T) return iterator(T);
187 }
188
189 return iterator();
190 }
191
191192 //===--------------------------------------------------===//
192193 // Utility methods.
193194 //===--------------------------------------------------===//