From f3760b0f2828250b4b5fb1a52601fe6b11ff328f Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 6 Nov 2015 13:22:16 -0800 Subject: 2379 - further improvements to map operations Commands run: $ sed -i 's/\([^. (]*\)\.find(\([^)]*\)) != [^.]*\.end()/contains_key(\1, \2)/g' 0[^0]*cc $ sed -i 's/\([^. (]*\)\.find(\([^)]*\)) == [^.]*\.end()/!contains_key(\1, \2)/g' 0[^0]*cc --- 046closure_name.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to '046closure_name.cc') diff --git a/046closure_name.cc b/046closure_name.cc index 70c3481e..3d8e2e00 100644 --- a/046closure_name.cc +++ b/046closure_name.cc @@ -65,7 +65,7 @@ void collect_surrounding_spaces(const recipe_ordinal r) { } if (s->right) raise_error << "slot 0 should have a single value in /names, but got " << inst.products.at(j).to_string() << '\n' << end(); const string& surrounding_recipe_name = s->value; - if (Surrounding_space.find(r) != Surrounding_space.end() + if (contains_key(Surrounding_space, r) && Surrounding_space[r] != get(Recipe_ordinal, surrounding_recipe_name)) { raise_error << "recipe " << get(Recipe, r).name << " can have only one 'surrounding' recipe but has " << Recipe[Surrounding_space[r]].name << " and " << surrounding_recipe_name << '\n' << end(); continue; @@ -99,7 +99,7 @@ long long int lookup_name(const reagent& x, const recipe_ordinal default_recipe) // recursively call transform_names on it. long long int lookup_name(const reagent& x, const recipe_ordinal r, set& done, vector& path) { if (!Name[r].empty()) return Name[r][x.name]; - if (done.find(r) != done.end()) { + if (contains_key(done, r)) { raise_error << "can't compute address of " << x.to_string() << " because " << end(); for (long long int i = 1; i < SIZE(path); ++i) { raise_error << path.at(i-1) << " requires computing names of " << path.at(i) << '\n' << end(); @@ -116,7 +116,7 @@ long long int lookup_name(const reagent& x, const recipe_ordinal r, set& nam } if (p->value != "0") return true; } - return names.find(r.name) != names.end(); + return contains_key(names, r.name); } -- cgit 1.4.1-2-gfad0