about summary refs log tree commit diff stats
path: root/030container.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-06 13:22:16 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-06 13:22:30 -0800
commitf3760b0f2828250b4b5fb1a52601fe6b11ff328f (patch)
tree69ec57c652ff823e92146281ba656e3eaba57eb7 /030container.cc
parent12f304a333ecee6326a8111e0d8e1c494ee92087 (diff)
downloadmu-f3760b0f2828250b4b5fb1a52601fe6b11ff328f.tar.gz
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
Diffstat (limited to '030container.cc')
-rw-r--r--030container.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/030container.cc b/030container.cc
index 2ad0a124..4ad2ee36 100644
--- a/030container.cc
+++ b/030container.cc
@@ -189,7 +189,7 @@ case GET: {
 :(code)
 const reagent element_type(const reagent& canonized_base, long long int offset_value) {
   assert(offset_value >= 0);
-  assert(Type.find(canonized_base.type->value) != Type.end());
+  assert(contains_key(Type, canonized_base.type->value));
   assert(!get(Type, canonized_base.type->value).name.empty());
   const type_info& info = get(Type, canonized_base.type->value);
   assert(info.kind == CONTAINER);
@@ -390,7 +390,7 @@ void insert_container(const string& command, kind_of_type kind, istream& in) {
   string name = next_word(in);
   // End container Name Refinements
   trace(9991, "parse") << "--- defining " << command << ' ' << name << end();
-  if (Type_ordinal.find(name) == Type_ordinal.end()
+  if (!contains_key(Type_ordinal, name)
       || get(Type_ordinal, name) == 0) {
     put(Type_ordinal, name, Next_type_ordinal++);
   }
@@ -412,7 +412,7 @@ void insert_container(const string& command, kind_of_type kind, istream& in) {
     for (type_tree** curr_type = &new_type; !inner.eof(); curr_type = &(*curr_type)->right) {
       string type_name = slurp_until(inner, ':');
       // End insert_container Special Uses(type_name)
-      if (Type_ordinal.find(type_name) == Type_ordinal.end()
+      if (!contains_key(Type_ordinal, type_name)
           // types can contain integers, like for array sizes
           && !is_integer(type_name)) {
         put(Type_ordinal, type_name, Next_type_ordinal++);
@@ -530,7 +530,7 @@ void check_invalid_types(const recipe_ordinal r) {
 void check_invalid_types(const type_tree* type, const string& block, const string& name) {
   if (!type) return;  // will throw a more precise error elsewhere
   // End Container Type Checks
-  if (type->value && (Type.find(type->value) == Type.end() || get(Type, type->value).name.empty())) {
+  if (type->value && (!contains_key(Type, type->value) || get(Type, type->value).name.empty())) {
     raise_error << block << "unknown type in " << name << '\n' << end();
   }
   if (type->left) check_invalid_types(type->left, block, name);