From 27320a07f60686343929eef9f0bfb961e8908fb3 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 5 Jun 2018 17:44:41 +0200 Subject: [PATCH] update statement loops to use C++11 syntax --- src/ModFile.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ModFile.cc b/src/ModFile.cc index 323b80b1..4aceca53 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -368,9 +368,9 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const set eqtags; map> var_model_eq_tags; map> var_model_info_var_expectation; - for (auto it = statements.begin(); it != statements.end(); it++) + for (auto & statement : statements) { - auto *vms = dynamic_cast(*it); + auto *vms = dynamic_cast(statement); if (vms != nullptr) { vms->getVarModelInfo(var_model_name, var_model_info_var_expectation, var_model_eq_tags); @@ -390,7 +390,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const // Var Model map, vector, vector, vector, int, vector, vector>> var_model_info_pac_expectation; - for (auto it = statements.begin(); it != statements.end(); it++) + for (auto & statement : statements) { int max_lag; string var_model_name; @@ -398,7 +398,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const vector lhs_expr_t; vector nonstationary, diff; vector lhs, eqnumber, orig_diff_var; - auto *vms = dynamic_cast(*it); + auto *vms = dynamic_cast(statement); if (vms != nullptr) { vector>> rhs; @@ -414,7 +414,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const var_model_info_pac_expectation[var_model_name] = { lhs, lhs_expr_t, diff, orig_diff_var, max_lag, nonstationary, eqnumber }; } - auto *pms = dynamic_cast(*it); + auto *pms = dynamic_cast(statement); if (pms != nullptr) { int growth_symb_id; @@ -525,10 +525,9 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const dynamic_model.combineDiffAuxEquations(); - for (vector::const_iterator it = statements.begin(); - it != statements.end(); it++) + for (auto & statement : statements) { - auto *vms = dynamic_cast(*it); + auto *vms = dynamic_cast(statement); if (vms != nullptr) { string var_model_name;