diff --git a/ml.cpp b/ml.cpp index 66e7cb2..e2b42fc 100644 --- a/ml.cpp +++ b/ml.cpp @@ -643,7 +643,7 @@ const char * MlError::what() const noexcept { void MlEnvironment::combine(MlEnvironment const &other) { // Normally, I would use the `insert` method of the `map` class, // but it doesn't overwrite previously declared values for keys. - std::map::const_iterator itr = other.defs.begin(); + auto itr = other.defs.begin(); for (; itr != other.defs.end(); itr++) { // Iterate through the keys and assign each value. defs[itr->first] = itr->second; @@ -651,7 +651,7 @@ void MlEnvironment::combine(MlEnvironment const &other) { } std::ostream &operator<<(std::ostream &os, MlEnvironment const &e) { - std::map::const_iterator itr = e.defs.begin(); + auto itr = e.defs.begin(); os << "{ "; for (; itr != e.defs.end(); itr++) { os << '\'' << itr->first << "' : " << itr->second.debug() << ", "; @@ -667,7 +667,7 @@ void MlEnvironment::set(const std::string &name, MlValue value) { void MlEnvironment::setX(const std::string &name, MlValue value) { MlEnvironment *e = this; while (e != nullptr) { - std::map::const_iterator itr = e->defs.find(name); + auto itr = e->defs.find(name); if (itr != e->defs.end()) { e->set(name, value); return; @@ -2063,7 +2063,7 @@ void load_std_lib(MlEnvironment &env) { // Does this environment, or its parent environment, have a variable? bool MlEnvironment::has(const std::string &name) const { - std::map::const_iterator itr = defs.find(name); + auto itr = defs.find(name); if (itr != defs.end()) // If it was found return true; @@ -2212,7 +2212,7 @@ MlValue MlEnvironment::get(const std::string &name) const { if (it != builtin_funcs.end()) return MlValue(name, it->second); - std::map::const_iterator itr = defs.find(name); + auto itr = defs.find(name); if (itr != defs.end()) return itr->second; else if (parent_scope != nullptr) { itr = parent_scope->defs.find(name);