Port to C++11 auto keyword

Performed using modernize-use-auto from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
issue#70
Sébastien Villemot 2018-06-04 15:03:26 +02:00
parent dcfc598196
commit c0ed97d247
23 changed files with 401 additions and 401 deletions

View File

@ -221,7 +221,7 @@ PriorPosteriorFunctionStatement::PriorPosteriorFunctionStatement(const bool prio
void void
PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) PriorPosteriorFunctionStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{ {
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("function"); auto it2 = options_list.string_options.find("function");
if (it2 == options_list.string_options.end() || it2->second.empty()) if (it2 == options_list.string_options.end() || it2->second.empty())
{ {
cerr << "ERROR: both the prior_function and posterior_function commands require the 'function' argument" cerr << "ERROR: both the prior_function and posterior_function commands require the 'function' argument"
@ -316,7 +316,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "M_.pac." << name << ".lhs = ["; output << "M_.pac." << name << ".lhs = [";
for (vector<int>::const_iterator it = lhs.begin(); it !=lhs.end(); it++) for (auto it = lhs.begin(); it !=lhs.end(); it++)
{ {
if (it != lhs.begin()) if (it != lhs.begin())
output << " "; output << " ";
@ -324,7 +324,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << name << ".undiff_eqtags = {"; << "M_.pac." << name << ".undiff_eqtags = {";
for (map<string, int>::const_iterator it = undiff.begin(); it != undiff.end(); it++) for (auto it = undiff.begin(); it != undiff.end(); it++)
{ {
if (it != undiff.begin()) if (it != undiff.begin())
output << "; "; output << "; ";
@ -332,7 +332,7 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "};" << endl output << "};" << endl
<< "M_.pac." << name << ".undiff_num = ["; << "M_.pac." << name << ".undiff_num = [";
for (map<string, int>::const_iterator it = undiff.begin(); it != undiff.end(); it++) for (auto it = undiff.begin(); it != undiff.end(); it++)
{ {
if (it != undiff.begin()) if (it != undiff.begin())
output << " "; output << " ";
@ -401,12 +401,12 @@ VarModelStatement::getVarModelInfo(string &var_model_name,
var_model_name = name; var_model_name = name;
if (symbol_list.empty()) if (symbol_list.empty())
{ {
OptionsList::vec_str_options_t::const_iterator it = options_list.vector_str_options.find("var.eqtags"); auto it = options_list.vector_str_options.find("var.eqtags");
var_model_eqtags[name] = it->second; var_model_eqtags[name] = it->second;
} }
else else
{ {
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("var.order"); auto it = options_list.num_options.find("var.order");
var_model_info[name] = make_pair(symbol_list, atoi(it->second.c_str())); var_model_info[name] = make_pair(symbol_list, atoi(it->second.c_str()));
} }
} }
@ -441,7 +441,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
symbol_list.writeOutput("options_.var.var_list_", output); symbol_list.writeOutput("options_.var.var_list_", output);
output << "options_.var.eqn = ["; output << "options_.var.eqn = [";
for (vector<int>::const_iterator it = eqnumber.begin(); for (auto it = eqnumber.begin();
it != eqnumber.end(); it++) it != eqnumber.end(); it++)
{ {
if (it != eqnumber.begin()) if (it != eqnumber.begin())
@ -450,7 +450,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl output << "];" << endl
<< "options_.var.lhs = ["; << "options_.var.lhs = [";
for (vector<int>::const_iterator it = lhs.begin(); for (auto it = lhs.begin();
it != lhs.end(); it++) it != lhs.end(); it++)
{ {
if (it != lhs.begin()) if (it != lhs.begin())
@ -460,7 +460,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
output << "];" << endl output << "];" << endl
<< "options_.var.max_lag = " << max_lag << ";" << endl << "options_.var.max_lag = " << max_lag << ";" << endl
<< "options_.var.nonstationary = ["; << "options_.var.nonstationary = [";
for (vector<bool>::const_iterator it = nonstationary.begin(); for (auto it = nonstationary.begin();
it != nonstationary.end(); it++) it != nonstationary.end(); it++)
{ {
if (it != nonstationary.begin()) if (it != nonstationary.begin())
@ -472,7 +472,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl output << "];" << endl
<< "options_.var.diff = ["; << "options_.var.diff = [";
for (vector<bool>::const_iterator it = diff.begin(); for (auto it = diff.begin();
it != diff.end(); it++) it != diff.end(); it++)
{ {
if (it != diff.begin()) if (it != diff.begin())
@ -484,7 +484,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl output << "];" << endl
<< "options_.var.orig_diff_var = ["; << "options_.var.orig_diff_var = [";
for (vector<int>::const_iterator it = orig_diff_var.begin(); for (auto it = orig_diff_var.begin();
it != orig_diff_var.end(); it++) it != orig_diff_var.end(); it++)
{ {
if (it != orig_diff_var.begin()) if (it != orig_diff_var.begin())
@ -496,11 +496,11 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl; output << "];" << endl;
int i = 1; int i = 1;
for (vector<set<pair<int, int > > >::const_iterator it = rhs_by_eq.begin(); for (auto it = rhs_by_eq.begin();
it != rhs_by_eq.end(); it++, i++) it != rhs_by_eq.end(); it++, i++)
{ {
output << "options_.var.rhs.vars_at_eq{" << i << "}.var = ["; output << "options_.var.rhs.vars_at_eq{" << i << "}.var = [";
for (set<pair<int, int> >::const_iterator it1 = it->begin(); for (auto it1 = it->begin();
it1 != it->end(); it1++) it1 != it->end(); it1++)
{ {
if (it1 != it->begin()) if (it1 != it->begin())
@ -509,7 +509,7 @@ VarModelStatement::writeOutput(ostream &output, const string &basename, bool min
} }
output << "];" << endl output << "];" << endl
<< "options_.var.rhs.vars_at_eq{" << i << "}.lag = ["; << "options_.var.rhs.vars_at_eq{" << i << "}.lag = [";
for (set<pair<int, int> >::const_iterator it1 = it->begin(); for (auto it1 = it->begin();
it1 != it->end(); it1++) it1 != it->end(); it1++)
{ {
if (it1 != it->begin()) if (it1 != it->begin())
@ -531,7 +531,7 @@ VarModelStatement::createVarModelMFunction(ostream &output, const map<string, se
stringstream ss; stringstream ss;
set<int> horizons = var_expectation_functions_to_write.find(name)->second; set<int> horizons = var_expectation_functions_to_write.find(name)->second;
for (set<int>::const_iterator it = horizons.begin(); it != horizons.end(); it++) for (auto it = horizons.begin(); it != horizons.end(); it++)
{ {
if (it != horizons.begin()) if (it != horizons.begin())
ss << " "; ss << " ";
@ -555,7 +555,7 @@ VarEstimationStatement::VarEstimationStatement(OptionsList options_list_arg) :
void void
VarEstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) VarEstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{ {
OptionsList::string_options_t::const_iterator it = options_list.string_options.find("var_estimation.model_name"); auto it = options_list.string_options.find("var_estimation.model_name");
if (it == options_list.string_options.end()) if (it == options_list.string_options.end())
{ {
cerr << "ERROR: You must provide the model name to the var_estimation statement." << endl; cerr << "ERROR: You must provide the model name to the var_estimation statement." << endl;
@ -594,7 +594,7 @@ VarRestrictionsStatement::findIdxInVector(const vector<string> &vecvars, const s
{ {
int idx = 0; int idx = 0;
bool setflag = false; bool setflag = false;
for (vector<string>::const_iterator itvs = vecvars.begin(); for (auto itvs = vecvars.begin();
itvs != vecvars.end(); itvs++, idx++) itvs != vecvars.end(); itvs++, idx++)
if (*itvs == var) if (*itvs == var)
{ {
@ -614,7 +614,7 @@ VarRestrictionsStatement::findIdxInVector(const vector<string> &vecvars, const s
void void
VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
map<string, vector<string> >::const_iterator itvs = var_map.find(var_model_name); auto itvs = var_map.find(var_model_name);
if (itvs == var_map.end()) if (itvs == var_map.end())
{ {
cerr << "ERROR: you are imposing restrictions on a VAR named " << var_model_name cerr << "ERROR: you are imposing restrictions on a VAR named " << var_model_name
@ -628,13 +628,13 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
// Exclusion Restrictions // Exclusion Restrictions
int idx = 1; int idx = 1;
for (map<int, map<int, SymbolList> >::const_iterator it = exclusion_restrictions.begin(); for (auto it = exclusion_restrictions.begin();
it != exclusion_restrictions.end(); it++, idx++) it != exclusion_restrictions.end(); it++, idx++)
{ {
output << Mstr << "exclusion_restrictions{" << idx<< "}.lag = " output << Mstr << "exclusion_restrictions{" << idx<< "}.lag = "
<< it->first << ";" << endl << it->first << ";" << endl
<< Mstr << "exclusion_restrictions{" << idx << "}.restrictions = ["; << Mstr << "exclusion_restrictions{" << idx << "}.restrictions = [";
for (map<int, SymbolList>::const_iterator it1 = it->second.begin(); for (auto it1 = it->second.begin();
it1 != it->second.end(); it1++) it1 != it->second.end(); it1++)
{ {
if (it1 != it->second.begin()) if (it1 != it->second.begin())
@ -654,7 +654,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
// Equation Restrictions // Equation Restrictions
idx = 1; idx = 1;
for (equation_restrictions_t::const_iterator it = equation_restrictions.begin(); for (auto it = equation_restrictions.begin();
it != equation_restrictions.end(); it++, idx++, nrestrictions++) it != equation_restrictions.end(); it++, idx++, nrestrictions++)
{ {
output << Mstr << "equation_restriction{" << idx << "}.eq = '" output << Mstr << "equation_restriction{" << idx << "}.eq = '"
@ -686,7 +686,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
// Cross Equation Restrictions // Cross Equation Restrictions
idx = 1; idx = 1;
for (crossequation_restrictions_t::const_iterator it = crossequation_restrictions.begin(); for (auto it = crossequation_restrictions.begin();
it != crossequation_restrictions.end(); it++, idx++, nrestrictions++) it != crossequation_restrictions.end(); it++, idx++, nrestrictions++)
{ {
output << Mstr << "crossequation_restriction{" << idx << "}.val = " output << Mstr << "crossequation_restriction{" << idx << "}.val = "
@ -720,7 +720,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
// Covariance Const Restrictions // Covariance Const Restrictions
idx = 1; idx = 1;
for (map<pair<int, int>, double>::const_iterator it = covariance_number_restriction.begin(); for (auto it = covariance_number_restriction.begin();
it != covariance_number_restriction.end(); it++, idx++) it != covariance_number_restriction.end(); it++, idx++)
output << Mstr << "covariance_const_restriction{" << idx << "}.var1 = '" output << Mstr << "covariance_const_restriction{" << idx << "}.var1 = '"
<< symbol_table.getName(it->first.first) << "';" << endl << symbol_table.getName(it->first.first) << "';" << endl
@ -731,7 +731,7 @@ VarRestrictionsStatement::writeOutput(ostream &output, const string &basename, b
// Covariance Pair Restrictions // Covariance Pair Restrictions
idx = 1; idx = 1;
for (map<pair<int, int>, pair<int, int> >::const_iterator it = covariance_pair_restriction.begin(); for (auto it = covariance_pair_restriction.begin();
it != covariance_pair_restriction.end(); it++, idx++) it != covariance_pair_restriction.end(); it++, idx++)
output << Mstr << "covariance_pair_restriction{" << idx << "}.var11 = '" output << Mstr << "covariance_pair_restriction{" << idx << "}.var11 = '"
<< symbol_table.getName(it->first.first) << "';" << endl << symbol_table.getName(it->first.first) << "';" << endl
@ -758,7 +758,7 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
mod_file_struct.stoch_simul_present = true; mod_file_struct.stoch_simul_present = true;
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str())); mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
@ -774,8 +774,8 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
mod_file_struct.k_order_solver = true; mod_file_struct.k_order_solver = true;
it = options_list.num_options.find("hp_filter"); it = options_list.num_options.find("hp_filter");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("bandpass.indicator"); auto it1 = options_list.num_options.find("bandpass.indicator");
OptionsList::num_options_t::const_iterator it2 = options_list.num_options.find("one_sided_hp_filter"); auto it2 = options_list.num_options.find("one_sided_hp_filter");
if ((it != options_list.num_options.end() && it1 != options_list.num_options.end()) if ((it != options_list.num_options.end() && it1 != options_list.num_options.end())
|| (it != options_list.num_options.end() && it2 != options_list.num_options.end()) || (it != options_list.num_options.end() && it2 != options_list.num_options.end())
|| (it1 != options_list.num_options.end() && it2 != options_list.num_options.end())) || (it1 != options_list.num_options.end() && it2 != options_list.num_options.end()))
@ -790,8 +790,8 @@ void
StochSimulStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const StochSimulStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
// Ensure that order 3 implies k_order (#844) // Ensure that order 3 implies k_order (#844)
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver"); auto it1 = options_list.num_options.find("k_order_solver");
if ((it1 != options_list.num_options.end() && it1->second == "1") if ((it1 != options_list.num_options.end() && it1->second == "1")
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3)) || (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
output << "options_.k_order_solver = 1;" << endl; output << "options_.k_order_solver = 1;" << endl;
@ -863,7 +863,7 @@ RamseyModelStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol
/* Fill in option_order of mod_file_struct /* Fill in option_order of mod_file_struct
Since ramsey model needs one further order of derivation (for example, for 1st order Since ramsey model needs one further order of derivation (for example, for 1st order
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */ approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
{ {
int order = atoi(it->second.c_str()); int order = atoi(it->second.c_str());
@ -895,8 +895,8 @@ RamseyModelStatement::writeOutput(ostream &output, const string &basename, bool
// It should probably rather be a M_ field, but we leave it in options_ for historical reason // It should probably rather be a M_ field, but we leave it in options_ for historical reason
// Ensure that order 3 implies k_order (#844) // Ensure that order 3 implies k_order (#844)
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver"); auto it1 = options_list.num_options.find("k_order_solver");
if ((it1 != options_list.num_options.end() && it1->second == "1") if ((it1 != options_list.num_options.end() && it1->second == "1")
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3)) || (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
output << "options_.k_order_solver = 1;" << endl; output << "options_.k_order_solver = 1;" << endl;
@ -934,7 +934,7 @@ void
RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
output << "M_.ramsey_model_constraints = {" << endl; output << "M_.ramsey_model_constraints = {" << endl;
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it) for (auto it = constraints.begin(); it != constraints.end(); ++it)
{ {
if (it != constraints.begin()) if (it != constraints.begin())
output << ", "; output << ", ";
@ -969,7 +969,7 @@ RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"ramsey_constraints\"" output << "{\"statementName\": \"ramsey_constraints\""
<< ", \"ramsey_model_constraints\": [" << endl; << ", \"ramsey_model_constraints\": [" << endl;
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it) for (auto it = constraints.begin(); it != constraints.end(); ++it)
{ {
if (it != constraints.begin()) if (it != constraints.begin())
output << ", "; output << ", ";
@ -1021,7 +1021,7 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
/* Fill in option_order of mod_file_struct /* Fill in option_order of mod_file_struct
Since ramsey policy needs one further order of derivation (for example, for 1st order Since ramsey policy needs one further order of derivation (for example, for 1st order
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */ approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
{ {
int order = atoi(it->second.c_str()); int order = atoi(it->second.c_str());
@ -1067,15 +1067,15 @@ void
RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
// Ensure that order 3 implies k_order (#844) // Ensure that order 3 implies k_order (#844)
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver"); auto it1 = options_list.num_options.find("k_order_solver");
if ((it1 != options_list.num_options.end() && it1->second == "1") if ((it1 != options_list.num_options.end() && it1->second == "1")
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3)) || (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
output << "options_.k_order_solver = 1;" << endl; output << "options_.k_order_solver = 1;" << endl;
options_list.writeOutput(output); options_list.writeOutput(output);
output << "var_list_ = {"; output << "var_list_ = {";
for (vector<string>::const_iterator it = ramsey_policy_list.begin(); for (auto it = ramsey_policy_list.begin();
it != ramsey_policy_list.end(); ++it) it != ramsey_policy_list.end(); ++it)
{ {
if (it != ramsey_policy_list.begin()) if (it != ramsey_policy_list.begin())
@ -1096,7 +1096,7 @@ RamseyPolicyStatement::writeJsonOutput(ostream &output) const
options_list.writeJsonOutput(output); options_list.writeJsonOutput(output);
} }
output << ", \"ramsey_policy_list\": ["; output << ", \"ramsey_policy_list\": [";
for (vector<string>::const_iterator it = ramsey_policy_list.begin(); for (auto it = ramsey_policy_list.begin();
it != ramsey_policy_list.end(); ++it) it != ramsey_policy_list.end(); ++it)
{ {
if (it != ramsey_policy_list.begin()) if (it != ramsey_policy_list.begin())
@ -1128,7 +1128,7 @@ DiscretionaryPolicyStatement::checkPass(ModFileStructure &mod_file_struct, Warni
/* Fill in option_order of mod_file_struct /* Fill in option_order of mod_file_struct
Since discretionary policy needs one further order of derivation (for example, for 1st order Since discretionary policy needs one further order of derivation (for example, for 1st order
approximation, it needs 2nd derivatives), we add 1 to the order declared by user */ approximation, it needs 2nd derivatives), we add 1 to the order declared by user */
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
{ {
int order = atoi(it->second.c_str()); int order = atoi(it->second.c_str());
@ -1156,8 +1156,8 @@ void
DiscretionaryPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const DiscretionaryPolicyStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
// Ensure that order 3 implies k_order (#844) // Ensure that order 3 implies k_order (#844)
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver"); auto it1 = options_list.num_options.find("k_order_solver");
if ((it1 != options_list.num_options.end() && it1->second == "1") if ((it1 != options_list.num_options.end() && it1->second == "1")
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3)) || (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
output << "options_.k_order_solver = 1;" << endl; output << "options_.k_order_solver = 1;" << endl;
@ -1197,7 +1197,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
mod_file_struct.estimation_present = true; mod_file_struct.estimation_present = true;
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
{ {
int order = atoi(it->second.c_str()); int order = atoi(it->second.c_str());
@ -1227,7 +1227,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
mod_file_struct.dsge_var_calibrated = it->second; mod_file_struct.dsge_var_calibrated = it->second;
// Fill in mod_file_struct.dsge_var_estimated // Fill in mod_file_struct.dsge_var_estimated
OptionsList::string_options_t::const_iterator it_str = options_list.string_options.find("dsge_var"); auto it_str = options_list.string_options.find("dsge_var");
if (it_str != options_list.string_options.end()) if (it_str != options_list.string_options.end())
mod_file_struct.dsge_var_estimated = true; mod_file_struct.dsge_var_estimated = true;
@ -1274,7 +1274,7 @@ EstimationStatement::writeOutput(ostream &output, const string &basename, bool m
options_list.writeOutput(output); options_list.writeOutput(output);
// Special treatment for order option and particle filter // Special treatment for order option and particle filter
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it == options_list.num_options.end()) if (it == options_list.num_options.end())
output << "options_.order = 1;" << endl; output << "options_.order = 1;" << endl;
else if (atoi(it->second.c_str()) == 2) else if (atoi(it->second.c_str()) == 2)
@ -1314,7 +1314,7 @@ DynareSensitivityStatement::DynareSensitivityStatement(OptionsList options_list_
void void
DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{ {
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("identification"); auto it = options_list.num_options.find("identification");
if (it != options_list.num_options.end() if (it != options_list.num_options.end()
&& it->second == "1") && it->second == "1")
mod_file_struct.identification_present = true; mod_file_struct.identification_present = true;
@ -1329,13 +1329,13 @@ DynareSensitivityStatement::writeOutput(ostream &output, const string &basename,
options_. options_.
\todo factorize this code between identification and dynare_sensitivity, \todo factorize this code between identification and dynare_sensitivity,
and provide a generic mechanism for this situation (maybe using regexps) */ and provide a generic mechanism for this situation (maybe using regexps) */
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay"); auto it = options_list.num_options.find("nodisplay");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
output << "options_.nodisplay = " << it->second << ";" << endl; output << "options_.nodisplay = " << it->second << ";" << endl;
it = options_list.num_options.find("nograph"); it = options_list.num_options.find("nograph");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
output << "options_.nograph = " << it->second << ";" << endl; output << "options_.nograph = " << it->second << ";" << endl;
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format"); auto it2 = options_list.string_options.find("graph_format");
if (it2 != options_list.string_options.end()) if (it2 != options_list.string_options.end())
output << "options_.graph_format = '" << it2->second << "';" << endl; output << "options_.graph_format = '" << it2->second << "';" << endl;
@ -1568,7 +1568,7 @@ EstimatedParamsStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"estimated_params\", " output << "{\"statementName\": \"estimated_params\", "
<< "\"params\": ["; << "\"params\": [";
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
if (it != estim_params_list.begin()) if (it != estim_params_list.begin())
output << ", "; output << ", ";
@ -1693,7 +1693,7 @@ EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
output << ", \"use_calibration_initialization\": 1"; output << ", \"use_calibration_initialization\": 1";
output << ", \"params\": ["; output << ", \"params\": [";
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
if (it != estim_params_list.begin()) if (it != estim_params_list.begin())
output << ", "; output << ", ";
@ -1811,7 +1811,7 @@ EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
output << "{\"statementName\": \"estimated_params_bounds\", " output << "{\"statementName\": \"estimated_params_bounds\", "
<< "\"params\": ["; << "\"params\": [";
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
if (it != estim_params_list.begin()) if (it != estim_params_list.begin())
output << ", "; output << ", ";
@ -1969,7 +1969,7 @@ OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"osr_params_bounds\"" output << "{\"statementName\": \"osr_params_bounds\""
<< ", \"bounds\": ["; << ", \"bounds\": [";
for (vector<OsrParams>::const_iterator it = osr_params_list.begin(); for (auto it = osr_params_list.begin();
it != osr_params_list.end(); it++) it != osr_params_list.end(); it++)
{ {
if (it != osr_params_list.begin()) if (it != osr_params_list.begin())
@ -1992,7 +1992,7 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation
mod_file_struct.osr_present = true; mod_file_struct.osr_present = true;
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str())); mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
@ -2012,8 +2012,8 @@ void
OsrStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const OsrStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
// Ensure that order 3 implies k_order (#844) // Ensure that order 3 implies k_order (#844)
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("order"); auto it = options_list.num_options.find("order");
OptionsList::num_options_t::const_iterator it1 = options_list.num_options.find("k_order_solver"); auto it1 = options_list.num_options.find("k_order_solver");
if ((it1 != options_list.num_options.end() && it1->second == "1") if ((it1 != options_list.num_options.end() && it1->second == "1")
|| (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3)) || (it != options_list.num_options.end() && atoi(it->second.c_str()) >= 3))
output << "options_.k_order_solver = 1;" << endl; output << "options_.k_order_solver = 1;" << endl;
@ -2094,7 +2094,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"optim_weights\", " output << "{\"statementName\": \"optim_weights\", "
<< "\"weights\": ["; << "\"weights\": [";
for (var_weights_t::const_iterator it = var_weights.begin(); for (auto it = var_weights.begin();
it != var_weights.end(); it++) it != var_weights.end(); it++)
{ {
if (it != var_weights.begin()) if (it != var_weights.begin())
@ -2105,7 +2105,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
output << "\"}"; output << "\"}";
} }
for (covar_weights_t::const_iterator it = covar_weights.begin(); for (auto it = covar_weights.begin();
it != covar_weights.end(); it++) it != covar_weights.end(); it++)
{ {
if (it != covar_weights.begin() || !var_weights.empty()) if (it != covar_weights.begin() || !var_weights.empty())
@ -2206,7 +2206,7 @@ ModelComparisonStatement::writeJsonOutput(ostream &output) const
if (!filename_list.empty()) if (!filename_list.empty())
output << ", \"filename_list\": {"; output << ", \"filename_list\": {";
for (filename_list_t::const_iterator it = filename_list.begin(); for (auto it = filename_list.begin();
it != filename_list.end(); it++) it != filename_list.end(); it++)
{ {
if (it != filename_list.begin()) if (it != filename_list.begin())
@ -2435,9 +2435,9 @@ MSSBVARSimulationStatement::writeOutput(ostream &output, const string &basename,
options_list.writeOutput(output); options_list.writeOutput(output);
// Redeclare drop option if necessary // Redeclare drop option if necessary
OptionsList::num_options_t::const_iterator mh_replic_it = options_list.num_options.find("ms.mh_replic"); auto mh_replic_it = options_list.num_options.find("ms.mh_replic");
OptionsList::num_options_t::const_iterator thinning_factor_it = options_list.num_options.find("ms.thinning_factor"); auto thinning_factor_it = options_list.num_options.find("ms.thinning_factor");
OptionsList::num_options_t::const_iterator drop_it = options_list.num_options.find("ms.drop"); auto drop_it = options_list.num_options.find("ms.drop");
if (mh_replic_it != options_list.num_options.end() || thinning_factor_it != options_list.num_options.end()) if (mh_replic_it != options_list.num_options.end() || thinning_factor_it != options_list.num_options.end())
if (drop_it == options_list.num_options.end()) if (drop_it == options_list.num_options.end())
output << "options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor;" << endl; output << "options_.ms.drop = 0.1*options_.ms.mh_replic*options_.ms.thinning_factor;" << endl;
@ -2543,7 +2543,7 @@ MSSBVARIrfStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
bool regimes_present = false; bool regimes_present = false;
bool filtered_probabilities_present = false; bool filtered_probabilities_present = false;
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("ms.regimes"); auto it = options_list.num_options.find("ms.regimes");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
regimes_present = true; regimes_present = true;
@ -2643,7 +2643,7 @@ MSSBVARVarianceDecompositionStatement::checkPass(ModFileStructure &mod_file_stru
bool regimes_present = false; bool regimes_present = false;
bool filtered_probabilities_present = false; bool filtered_probabilities_present = false;
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("ms.regimes"); auto it = options_list.num_options.find("ms.regimes");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
regimes_present = true; regimes_present = true;
@ -2711,13 +2711,13 @@ IdentificationStatement::writeOutput(ostream &output, const string &basename, bo
options_. options_.
\todo factorize this code between identification and dynare_sensitivity, \todo factorize this code between identification and dynare_sensitivity,
and provide a generic mechanism for this situation (maybe using regexps) */ and provide a generic mechanism for this situation (maybe using regexps) */
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nodisplay"); auto it = options_list.num_options.find("nodisplay");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
output << "options_.nodisplay = " << it->second << ";" << endl; output << "options_.nodisplay = " << it->second << ";" << endl;
it = options_list.num_options.find("nograph"); it = options_list.num_options.find("nograph");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
output << "options_.nograph = " << it->second << ";" << endl; output << "options_.nograph = " << it->second << ";" << endl;
OptionsList::string_options_t::const_iterator it2 = options_list.string_options.find("graph_format"); auto it2 = options_list.string_options.find("graph_format");
if (it2 != options_list.string_options.end()) if (it2 != options_list.string_options.end())
output << "options_.graph_format = '" << it2->second << "';" << endl; output << "options_.graph_format = '" << it2->second << "';" << endl;
@ -3032,7 +3032,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
output << "options_.ms.Qi = cell(" << n << ",1);" << endl; output << "options_.ms.Qi = cell(" << n << ",1);" << endl;
output << "options_.ms.Ri = cell(" << n << ",1);" << endl; output << "options_.ms.Ri = cell(" << n << ",1);" << endl;
for (svar_identification_restrictions_t::const_iterator it = restrictions.begin(); it != restrictions.end(); it++) for (auto it = restrictions.begin(); it != restrictions.end(); it++)
{ {
assert(it->lag >= 0); assert(it->lag >= 0);
if (it->lag == 0) if (it->lag == 0)
@ -3074,7 +3074,7 @@ SvarIdentificationStatement::writeJsonOutput(ostream &output) const
output << ", \"nlags\": " << getMaxLag() output << ", \"nlags\": " << getMaxLag()
<< ", \"restrictions\": ["; << ", \"restrictions\": [";
for (svar_identification_restrictions_t::const_iterator it = restrictions.begin(); it != restrictions.end(); it++) for (auto it = restrictions.begin(); it != restrictions.end(); it++)
{ {
if (it != restrictions.begin()) if (it != restrictions.begin())
output << ", "; output << ", ";
@ -3094,14 +3094,14 @@ SvarIdentificationStatement::writeJsonOutput(ostream &output) const
MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg) : MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg) :
options_list(move(options_list_arg)) options_list(move(options_list_arg))
{ {
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("ms.restrictions"); auto it_num = options_list.num_options.find("ms.restrictions");
if (it_num != options_list.num_options.end()) if (it_num != options_list.num_options.end())
{ {
using namespace boost; using namespace boost;
OptionsList::num_options_t::const_iterator it_num_regimes auto it_num_regimes
= options_list.num_options.find("ms.number_of_regimes"); = options_list.num_options.find("ms.number_of_regimes");
assert(it_num_regimes != options_list.num_options.end()); assert(it_num_regimes != options_list.num_options.end());
int num_regimes = lexical_cast< int >(it_num_regimes->second); auto num_regimes = lexical_cast< int >(it_num_regimes->second);
vector<string> tokenizedRestrictions; vector<string> tokenizedRestrictions;
split(tokenizedRestrictions, it_num->second, is_any_of("["), token_compress_on); split(tokenizedRestrictions, it_num->second, is_any_of("["), token_compress_on);
@ -3110,7 +3110,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
{ {
vector<string> restriction; vector<string> restriction;
split(restriction, tokenizedRestriction, is_any_of("], ")); split(restriction, tokenizedRestriction, is_any_of("], "));
for (vector<string>::iterator it1 = restriction.begin(); for (auto it1 = restriction.begin();
it1 != restriction.end();) it1 != restriction.end();)
if (it1->empty()) if (it1->empty())
restriction.erase(it1); restriction.erase(it1);
@ -3126,8 +3126,8 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
try try
{ {
int from_regime = lexical_cast< int >(restriction[0]); auto from_regime = lexical_cast< int >(restriction[0]);
int to_regime = lexical_cast< int >(restriction[1]); auto to_regime = lexical_cast< int >(restriction[1]);
if (from_regime > num_regimes || to_regime > num_regimes) if (from_regime > num_regimes || to_regime > num_regimes)
{ {
cerr << "ERROR: the regimes specified in the restrictions option must be " cerr << "ERROR: the regimes specified in the restrictions option must be "
@ -3143,7 +3143,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
double transition_probability = lexical_cast< double >(restriction[2]); auto transition_probability = lexical_cast< double >(restriction[2]);
if (transition_probability > 1.0) if (transition_probability > 1.0)
{ {
cerr << "ERROR: the transition probability, " << transition_probability cerr << "ERROR: the transition probability, " << transition_probability
@ -3166,7 +3166,7 @@ MarkovSwitchingStatement::MarkovSwitchingStatement(OptionsList options_list_arg)
void void
MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{ {
OptionsList::num_options_t::const_iterator itChain = options_list.num_options.find("ms.chain"); auto itChain = options_list.num_options.find("ms.chain");
assert(itChain != options_list.num_options.end()); assert(itChain != options_list.num_options.end());
int chainNumber = atoi(itChain->second.c_str()); int chainNumber = atoi(itChain->second.c_str());
if (++mod_file_struct.last_markov_switching_chain != chainNumber) if (++mod_file_struct.last_markov_switching_chain != chainNumber)
@ -3176,14 +3176,14 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("ms.restrictions"); auto it_num = options_list.num_options.find("ms.restrictions");
if (it_num != options_list.num_options.end()) if (it_num != options_list.num_options.end())
{ {
using namespace boost; using namespace boost;
OptionsList::num_options_t::const_iterator it_num_regimes auto it_num_regimes
= options_list.num_options.find("ms.number_of_regimes"); = options_list.num_options.find("ms.number_of_regimes");
assert(it_num_regimes != options_list.num_options.end()); assert(it_num_regimes != options_list.num_options.end());
int num_regimes = lexical_cast< int >(it_num_regimes->second); auto num_regimes = lexical_cast< int >(it_num_regimes->second);
vector<double> col_trans_prob_sum(num_regimes, 0); vector<double> col_trans_prob_sum(num_regimes, 0);
vector<double> row_trans_prob_sum(num_regimes, 0); vector<double> row_trans_prob_sum(num_regimes, 0);
vector<bool> all_restrictions_in_row(num_regimes, true); vector<bool> all_restrictions_in_row(num_regimes, true);
@ -3283,7 +3283,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
{ {
output << endl; output << endl;
OptionsList::num_options_t::const_iterator it auto it
= options_list.num_options.find("ms.chain"); = options_list.num_options.find("ms.chain");
assert(it != options_list.num_options.end()); assert(it != options_list.num_options.end());
output << "chain = " << it->second << ";" << endl; output << "chain = " << it->second << ";" << endl;
@ -3309,7 +3309,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
if (!itvs.empty()) if (!itvs.empty())
output << "duration.push_back(" << itvs << ");" << endl; output << "duration.push_back(" << itvs << ");" << endl;
OptionsList::symbol_list_options_t::const_iterator itsl auto itsl
= options_list.symbol_list_options.find("ms.parameters"); = options_list.symbol_list_options.find("ms.parameters");
assert(itsl != options_list.symbol_list_options.end()); assert(itsl != options_list.symbol_list_options.end());
vector<string> parameters = itsl->second.get_symbols(); vector<string> parameters = itsl->second.get_symbols();
@ -3338,7 +3338,7 @@ MarkovSwitchingStatement::writeJsonOutput(ostream &output) const
if (!restriction_map.empty()) if (!restriction_map.empty())
output << ", {"; output << ", {";
for (map<pair<int, int>, double >::const_iterator it = restriction_map.begin(); for (auto it = restriction_map.begin();
it != restriction_map.end(); it++) it != restriction_map.end(); it++)
{ {
if (it != restriction_map.begin()) if (it != restriction_map.begin())
@ -3477,7 +3477,7 @@ EstimationDataStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon
{ {
mod_file_struct.estimation_data_statement_present = true; mod_file_struct.estimation_data_statement_present = true;
OptionsList::num_options_t::const_iterator it = options_list.num_options.find("nobs"); auto it = options_list.num_options.find("nobs");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
if (atoi(it->second.c_str()) <= 0) if (atoi(it->second.c_str()) <= 0)
{ {
@ -3547,7 +3547,7 @@ SubsamplesStatement::writeOutput(ostream &output, const string &basename, bool m
<< "estimation_info.subsamples(subsamples_indx).range_index = {};" << endl; << "estimation_info.subsamples(subsamples_indx).range_index = {};" << endl;
int map_indx = 1; int map_indx = 1;
for (subsample_declaration_map_t::const_iterator it = subsample_declaration_map.begin(); for (auto it = subsample_declaration_map.begin();
it != subsample_declaration_map.end(); it++, map_indx++) it != subsample_declaration_map.end(); it++, map_indx++)
output << "estimation_info.subsamples(subsamples_indx).range_index(" << map_indx << ") = {'" output << "estimation_info.subsamples(subsamples_indx).range_index(" << map_indx << ") = {'"
<< it->first << "'};" << endl << it->first << "'};" << endl
@ -3600,7 +3600,7 @@ SubsamplesStatement::writeJsonOutput(ostream &output) const
output << ", \"name2\": \"" << name2 << "\""; output << ", \"name2\": \"" << name2 << "\"";
output << ", \"declarations\": {"; output << ", \"declarations\": {";
for (subsample_declaration_map_t::const_iterator it = subsample_declaration_map.begin(); for (auto it = subsample_declaration_map.begin();
it != subsample_declaration_map.end(); it++) it != subsample_declaration_map.end(); it++)
{ {
if (it != subsample_declaration_map.begin()) if (it != subsample_declaration_map.begin())
@ -3721,7 +3721,7 @@ JointPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain"); auto it_num = options_list.num_options.find("domain");
if (it_num != options_list.num_options.end()) if (it_num != options_list.num_options.end())
{ {
using namespace boost; using namespace boost;
@ -3783,7 +3783,7 @@ JointPriorStatement::writeOutput(ostream &output, const string &basename, bool m
void void
JointPriorStatement::writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const JointPriorStatement::writeOutputHelper(ostream &output, const string &field, const string &lhs_field) const
{ {
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field); auto itn = options_list.num_options.find(field);
output << lhs_field << "." << field << " = {"; output << lhs_field << "." << field << " = {";
if (field == "variance") if (field == "variance")
output << "{"; output << "{";
@ -3801,7 +3801,7 @@ JointPriorStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"joint_prior\"" output << "{\"statementName\": \"joint_prior\""
<< ", \"key\": ["; << ", \"key\": [";
for (vector<string>::const_iterator it = joint_parameters.begin(); it != joint_parameters.end(); it++) for (auto it = joint_parameters.begin(); it != joint_parameters.end(); it++)
{ {
if (it != joint_parameters.begin()) if (it != joint_parameters.begin())
output << ", "; output << ", ";
@ -3882,7 +3882,7 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
OptionsList::num_options_t::const_iterator it_stdev = options_list.num_options.find("stdev"); auto it_stdev = options_list.num_options.find("stdev");
if ((it_stdev == options_list.num_options.end() && variance == NULL) if ((it_stdev == options_list.num_options.end() && variance == NULL)
|| (it_stdev != options_list.num_options.end() && variance != NULL)) || (it_stdev != options_list.num_options.end() && variance != NULL))
{ {
@ -3890,7 +3890,7 @@ BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain"); auto it_num = options_list.num_options.find("domain");
if (it_num != options_list.num_options.end()) if (it_num != options_list.num_options.end())
{ {
using namespace boost; using namespace boost;
@ -3950,7 +3950,7 @@ BasicPriorStatement::writeCommonOutput(ostream &output, const string &lhs_field)
void void
BasicPriorStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const BasicPriorStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const
{ {
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field); auto itn = options_list.num_options.find(field);
if (itn != options_list.num_options.end()) if (itn != options_list.num_options.end())
output << lhs_field << "." << field << " = "<< itn->second << ";" << endl; output << lhs_field << "." << field << " = "<< itn->second << ";" << endl;
} }
@ -4004,7 +4004,7 @@ void
BasicPriorStatement::writeCDomain(ostream &output) const BasicPriorStatement::writeCDomain(ostream &output) const
{ {
output << "domain.clear();" << endl; output << "domain.clear();" << endl;
OptionsList::num_options_t::const_iterator it_num = options_list.num_options.find("domain"); auto it_num = options_list.num_options.find("domain");
if (it_num != options_list.num_options.end()) if (it_num != options_list.num_options.end())
{ {
using namespace boost; using namespace boost;
@ -4019,7 +4019,7 @@ BasicPriorStatement::writeCDomain(ostream &output) const
void void
BasicPriorStatement::writeCOutputHelper(ostream &output, const string &field) const BasicPriorStatement::writeCOutputHelper(ostream &output, const string &field) const
{ {
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field); auto itn = options_list.num_options.find(field);
if (itn != options_list.num_options.end()) if (itn != options_list.num_options.end())
output << field << " = " << itn->second << ";" << endl; output << field << " = " << itn->second << ";" << endl;
else else
@ -4442,7 +4442,7 @@ BasicOptionsStatement::writeCommonOutput(ostream &output, const string &lhs_fiel
void void
BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &field, const string &lhs_field) const
{ {
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field); auto itn = options_list.num_options.find(field);
if (itn != options_list.num_options.end()) if (itn != options_list.num_options.end())
output << lhs_field << "." << field << " = " << itn->second << ";" << endl; output << lhs_field << "." << field << " = " << itn->second << ";" << endl;
} }
@ -4450,7 +4450,7 @@ BasicOptionsStatement::writeCommonOutputHelper(ostream &output, const string &fi
void void
BasicOptionsStatement::writeCOutputHelper(ostream &output, const string &field) const BasicOptionsStatement::writeCOutputHelper(ostream &output, const string &field) const
{ {
OptionsList::num_options_t::const_iterator itn = options_list.num_options.find(field); auto itn = options_list.num_options.find(field);
if (itn != options_list.num_options.end()) if (itn != options_list.num_options.end())
output << field << " = " << itn->second << ";" << endl; output << field << " = " << itn->second << ";" << endl;
else else
@ -4774,7 +4774,7 @@ void
CalibSmootherStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const CalibSmootherStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
options_list.writeOutput(output); options_list.writeOutput(output);
OptionsList::string_options_t::const_iterator it = options_list.string_options.find("parameter_set"); auto it = options_list.string_options.find("parameter_set");
if (it == options_list.string_options.end()) if (it == options_list.string_options.end())
output << "options_.parameter_set = 'calibration';" << endl; output << "options_.parameter_set = 'calibration';" << endl;
symbol_list.writeOutput("var_list_", output); symbol_list.writeOutput("var_list_", output);
@ -4817,7 +4817,7 @@ ExtendedPathStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
} }
// Fill in option_occbin of mod_file_struct // Fill in option_occbin of mod_file_struct
OptionsList::string_options_t::const_iterator it = options_list.num_options.find("occbin"); auto it = options_list.num_options.find("occbin");
if (it != options_list.string_options.end()) if (it != options_list.string_options.end())
mod_file_struct.occbin_option = true; mod_file_struct.occbin_option = true;
} }

View File

@ -402,7 +402,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
else else
try try
{ {
double weight = lexical_cast<double>(token.c_str()); auto weight = lexical_cast<double>(token.c_str());
if (weight <= 0) if (weight <= 0)
{ {
cerr << "ERROR (in config file): Misspecification of weights passed to Members option." << endl; cerr << "ERROR (in config file): Misspecification of weights passed to Members option." << endl;

View File

@ -55,7 +55,7 @@ DataTree::AddNonNegativeConstant(const string &value)
{ {
int id = num_constants.AddNonNegativeConstant(value); int id = num_constants.AddNonNegativeConstant(value);
num_const_node_map_t::iterator it = num_const_node_map.find(id); auto it = num_const_node_map.find(id);
if (it != num_const_node_map.end()) if (it != num_const_node_map.end())
return it->second; return it->second;
else else
@ -65,7 +65,7 @@ DataTree::AddNonNegativeConstant(const string &value)
VariableNode * VariableNode *
DataTree::AddVariableInternal(int symb_id, int lag) DataTree::AddVariableInternal(int symb_id, int lag)
{ {
variable_node_map_t::iterator it = variable_node_map.find(make_pair(symb_id, lag)); auto it = variable_node_map.find(make_pair(symb_id, lag));
if (it != variable_node_map.end()) if (it != variable_node_map.end())
return it->second; return it->second;
else else
@ -94,7 +94,7 @@ DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
if (iArg1 != Zero && iArg2 != Zero) if (iArg1 != Zero && iArg2 != Zero)
{ {
// Simplify x+(-y) in x-y // Simplify x+(-y) in x-y
UnaryOpNode *uarg2 = dynamic_cast<UnaryOpNode *>(iArg2); auto *uarg2 = dynamic_cast<UnaryOpNode *>(iArg2);
if (uarg2 != NULL && uarg2->get_op_code() == oUminus) if (uarg2 != NULL && uarg2->get_op_code() == oUminus)
return AddMinus(iArg1, uarg2->get_arg()); return AddMinus(iArg1, uarg2->get_arg());
@ -137,7 +137,7 @@ DataTree::AddUMinus(expr_t iArg1)
if (iArg1 != Zero) if (iArg1 != Zero)
{ {
// Simplify -(-x) in x // Simplify -(-x) in x
UnaryOpNode *uarg = dynamic_cast<UnaryOpNode *>(iArg1); auto *uarg = dynamic_cast<UnaryOpNode *>(iArg1);
if (uarg != NULL && uarg->get_op_code() == oUminus) if (uarg != NULL && uarg->get_op_code() == oUminus)
return uarg->get_arg(); return uarg->get_arg();
@ -506,7 +506,7 @@ DataTree::AddVarExpectation(const int symb_id, const int forecast_horizon, const
{ {
assert(symbol_table.getType(symb_id) == eEndogenous); assert(symbol_table.getType(symb_id) == eEndogenous);
var_expectation_node_map_t::iterator it = var_expectation_node_map.find(make_pair(model_name, make_pair(symb_id, forecast_horizon))); auto it = var_expectation_node_map.find(make_pair(model_name, make_pair(symb_id, forecast_horizon)));
if (it != var_expectation_node_map.end()) if (it != var_expectation_node_map.end())
return it->second; return it->second;
@ -516,7 +516,7 @@ DataTree::AddVarExpectation(const int symb_id, const int forecast_horizon, const
expr_t expr_t
DataTree::AddPacExpectation(const string &model_name) DataTree::AddPacExpectation(const string &model_name)
{ {
pac_expectation_node_map_t::iterator it = pac_expectation_node_map.find(model_name); auto it = pac_expectation_node_map.find(model_name);
if (it != pac_expectation_node_map.end()) if (it != pac_expectation_node_map.end())
return it->second; return it->second;
@ -535,7 +535,7 @@ DataTree::AddLocalVariable(int symb_id, expr_t value) throw (LocalVariableExcept
assert(symbol_table.getType(symb_id) == eModelLocalVariable); assert(symbol_table.getType(symb_id) == eModelLocalVariable);
// Throw an exception if symbol already declared // Throw an exception if symbol already declared
map<int, expr_t>::iterator it = local_variables_table.find(symb_id); auto it = local_variables_table.find(symb_id);
if (it != local_variables_table.end()) if (it != local_variables_table.end())
throw LocalVariableException(symbol_table.getName(symb_id)); throw LocalVariableException(symbol_table.getName(symb_id));
@ -548,7 +548,7 @@ DataTree::AddExternalFunction(int symb_id, const vector<expr_t> &arguments)
{ {
assert(symbol_table.getType(symb_id) == eExternalFunction); assert(symbol_table.getType(symb_id) == eExternalFunction);
external_function_node_map_t::iterator it = external_function_node_map.find(make_pair(arguments, symb_id)); auto it = external_function_node_map.find(make_pair(arguments, symb_id));
if (it != external_function_node_map.end()) if (it != external_function_node_map.end())
return it->second; return it->second;
@ -560,7 +560,7 @@ DataTree::AddFirstDerivExternalFunction(int top_level_symb_id, const vector<expr
{ {
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction); assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
first_deriv_external_function_node_map_t::iterator it auto it
= first_deriv_external_function_node_map.find(make_pair(make_pair(arguments, input_index), = first_deriv_external_function_node_map.find(make_pair(make_pair(arguments, input_index),
top_level_symb_id)); top_level_symb_id));
if (it != first_deriv_external_function_node_map.end()) if (it != first_deriv_external_function_node_map.end())
@ -574,7 +574,7 @@ DataTree::AddSecondDerivExternalFunction(int top_level_symb_id, const vector<exp
{ {
assert(symbol_table.getType(top_level_symb_id) == eExternalFunction); assert(symbol_table.getType(top_level_symb_id) == eExternalFunction);
second_deriv_external_function_node_map_t::iterator it auto it
= second_deriv_external_function_node_map.find(make_pair(make_pair(arguments, = second_deriv_external_function_node_map.find(make_pair(make_pair(arguments,
make_pair(input_index1, input_index2)), make_pair(input_index1, input_index2)),
top_level_symb_id)); top_level_symb_id));

View File

@ -330,13 +330,13 @@ inline expr_t
DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int param1_symb_id, int param2_symb_id, const string &adl_param_name, const vector<int> &adl_lags) DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int param1_symb_id, int param2_symb_id, const string &adl_param_name, const vector<int> &adl_lags)
{ {
// If the node already exists in tree, share it // If the node already exists in tree, share it
unary_op_node_map_t::iterator it = unary_op_node_map.find(make_pair(make_pair(arg, op_code), make_pair(make_pair(arg_exp_info_set, make_pair(param1_symb_id, param2_symb_id)), make_pair(adl_param_name, adl_lags)))); auto it = unary_op_node_map.find(make_pair(make_pair(arg, op_code), make_pair(make_pair(arg_exp_info_set, make_pair(param1_symb_id, param2_symb_id)), make_pair(adl_param_name, adl_lags))));
if (it != unary_op_node_map.end()) if (it != unary_op_node_map.end())
return it->second; return it->second;
// Try to reduce to a constant // Try to reduce to a constant
// Case where arg is a constant and op_code == oUminus (i.e. we're adding a negative constant) is skipped // Case where arg is a constant and op_code == oUminus (i.e. we're adding a negative constant) is skipped
NumConstNode *carg = dynamic_cast<NumConstNode *>(arg); auto *carg = dynamic_cast<NumConstNode *>(arg);
if (op_code != oUminus || carg == NULL) if (op_code != oUminus || carg == NULL)
{ {
try try
@ -355,7 +355,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, int
inline expr_t inline expr_t
DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerDerivOrder) DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerDerivOrder)
{ {
binary_op_node_map_t::iterator it = binary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), powerDerivOrder), op_code)); auto it = binary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), powerDerivOrder), op_code));
if (it != binary_op_node_map.end()) if (it != binary_op_node_map.end())
return it->second; return it->second;
@ -376,7 +376,7 @@ DataTree::AddBinaryOp(expr_t arg1, BinaryOpcode op_code, expr_t arg2, int powerD
inline expr_t inline expr_t
DataTree::AddTrinaryOp(expr_t arg1, TrinaryOpcode op_code, expr_t arg2, expr_t arg3) DataTree::AddTrinaryOp(expr_t arg1, TrinaryOpcode op_code, expr_t arg2, expr_t arg3)
{ {
trinary_op_node_map_t::iterator it = trinary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code)); auto it = trinary_op_node_map.find(make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code));
if (it != trinary_op_node_map.end()) if (it != trinary_op_node_map.end())
return it->second; return it->second;

View File

@ -62,7 +62,7 @@ DynamicModel::AddVariable(int symb_id, int lag)
void void
DynamicModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, int lag, const map_idx_t &map_idx) const DynamicModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, int lag, const map_idx_t &map_idx) const
{ {
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), lag))); auto it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), lag)));
if (it != first_derivatives.end()) if (it != first_derivatives.end())
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false); (it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
else else
@ -75,7 +75,7 @@ DynamicModel::compileDerivative(ofstream &code_file, unsigned int &instruction_n
void void
DynamicModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, const map_idx_t &map_idx) const DynamicModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, const map_idx_t &map_idx) const
{ {
map<pair<int, pair<int, int> >, expr_t>::const_iterator it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag))); auto it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
if (it != first_chain_rule_derivatives.end()) if (it != first_chain_rule_derivatives.end())
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false); (it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, true, false);
else else
@ -255,7 +255,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
int prev_lag; int prev_lag;
unsigned int prev_var, count_col, count_col_endo, count_col_exo, count_col_exo_det, count_col_other_endo; unsigned int prev_var, count_col, count_col_endo, count_col_exo, count_col_exo_det, count_col_other_endo;
map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second; tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
prev_var = 999999999; prev_var = 999999999;
prev_lag = -9999999; prev_lag = -9999999;
@ -272,7 +272,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
} }
} }
map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_derivative;
for (derivative_t::const_iterator it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++) for (auto it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
tmp_block_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_block_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
prev_var = 999999999; prev_var = 999999999;
prev_lag = -9999999; prev_lag = -9999999;
@ -289,7 +289,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
} }
} }
map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_det_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_block_exo_det_derivative;
for (derivative_t::const_iterator it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++) for (auto it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
tmp_block_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_block_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
prev_var = 999999999; prev_var = 999999999;
prev_lag = -9999999; prev_lag = -9999999;
@ -306,7 +306,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
} }
} }
map<pair<int, pair<int, int> >, expr_t> tmp_block_other_endo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_block_other_endo_derivative;
for (derivative_t::const_iterator it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++) for (auto it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
tmp_block_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_block_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
prev_var = 999999999; prev_var = 999999999;
prev_lag = -9999999; prev_lag = -9999999;
@ -673,7 +673,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
case SOLVE_BACKWARD_COMPLETE: case SOLVE_BACKWARD_COMPLETE:
case SOLVE_FORWARD_COMPLETE: case SOLVE_FORWARD_COMPLETE:
output << " else" << endl; output << " else" << endl;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -697,7 +697,7 @@ DynamicModel::writeModelEquationsOrdered_M(const string &dynamic_basename) const
case SOLVE_TWO_BOUNDARIES_SIMPLE: case SOLVE_TWO_BOUNDARIES_SIMPLE:
case SOLVE_TWO_BOUNDARIES_COMPLETE: case SOLVE_TWO_BOUNDARIES_COMPLETE:
output << " else" << endl; output << " else" << endl;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -1109,16 +1109,16 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
file_open = true; file_open = true;
} }
map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_block_endo_derivative;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second; tmp_block_endo_derivative[make_pair(it->second.first, make_pair(it->first.second, it->first.first))] = it->second.second;
map<pair<int, pair<int, int> >, expr_t> tmp_exo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_exo_derivative;
for (derivative_t::const_iterator it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++) for (auto it = derivative_exo[block].begin(); it != (derivative_exo[block]).end(); it++)
tmp_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_exo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
map<pair<int, pair<int, int> >, expr_t> tmp_exo_det_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_exo_det_derivative;
for (derivative_t::const_iterator it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++) for (auto it = derivative_exo_det[block].begin(); it != (derivative_exo_det[block]).end(); it++)
tmp_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_exo_det_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
map<pair<int, pair<int, int> >, expr_t> tmp_other_endo_derivative; map<pair<int, pair<int, int> >, expr_t> tmp_other_endo_derivative;
for (derivative_t::const_iterator it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++) for (auto it = derivative_other_endo[block].begin(); it != (derivative_other_endo[block]).end(); it++)
tmp_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second; tmp_other_endo_derivative[make_pair(it->first.first, make_pair(it->first.second.second, it->first.second.first))] = it->second;
int prev_var = -1; int prev_var = -1;
int prev_lag = -999999999; int prev_lag = -999999999;
@ -1137,7 +1137,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
unsigned int count_col_det_exo = 0; unsigned int count_col_det_exo = 0;
vector<unsigned int> exo_det; vector<unsigned int> exo_det;
for (const auto & it : exo_det_block[block]) for (const auto & it : exo_det_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
{ {
count_col_det_exo++; count_col_det_exo++;
if (find(exo_det.begin(), exo_det.end(), *it1) == exo_det.end()) if (find(exo_det.begin(), exo_det.end(), *it1) == exo_det.end())
@ -1147,7 +1147,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
unsigned int count_col_exo = 0; unsigned int count_col_exo = 0;
vector<unsigned int> exo; vector<unsigned int> exo;
for (const auto & it : exo_block[block]) for (const auto & it : exo_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
{ {
count_col_exo++; count_col_exo++;
if (find(exo.begin(), exo.end(), *it1) == exo.end()) if (find(exo.begin(), exo.end(), *it1) == exo.end())
@ -1157,7 +1157,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
vector<unsigned int> other_endo; vector<unsigned int> other_endo;
unsigned int count_col_other_endo = 0; unsigned int count_col_other_endo = 0;
for (const auto & it : other_endo_block[block]) for (const auto & it : other_endo_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
{ {
count_col_other_endo++; count_col_other_endo++;
if (find(other_endo.begin(), other_endo.end(), *it1) == other_endo.end()) if (find(other_endo.begin(), other_endo.end(), *it1) == other_endo.end())
@ -1316,7 +1316,7 @@ DynamicModel::writeModelEquationsCode_Block(string &file_name, const string &bin
case SOLVE_TWO_BOUNDARIES_COMPLETE: case SOLVE_TWO_BOUNDARIES_COMPLETE:
case SOLVE_TWO_BOUNDARIES_SIMPLE: case SOLVE_TWO_BOUNDARIES_SIMPLE:
count_u = feedback_variables.size(); count_u = feedback_variables.size();
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
int lag = it->second.first; int lag = it->second.first;
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
@ -1543,7 +1543,7 @@ DynamicModel::writeVarExpectationCalls(ostream &output) const
output << "dynamic_var_forecast_" << it.first << " = " output << "dynamic_var_forecast_" << it.first << " = "
<< "var_forecast_" << it.first << "(y);" << endl; << "var_forecast_" << it.first << "(y);" << endl;
for (set<int>::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
output << "dynamic_var_forecast_" << it.first << "_" << *it1 << " = " output << "dynamic_var_forecast_" << it.first << "_" << *it1 << " = "
<< "dynamic_var_forecast_" << it.first << "(" << ++i << ", :);" << endl; << "dynamic_var_forecast_" << it.first << "(" << ++i << ", :);" << endl;
} }
@ -1710,7 +1710,7 @@ DynamicModel::printNonZeroHessianEquations(ostream &output) const
{ {
if (nonzero_hessian_eqs.size() != 1) if (nonzero_hessian_eqs.size() != 1)
output << "["; output << "[";
for (map<int, string>::const_iterator it = nonzero_hessian_eqs.begin(); for (auto it = nonzero_hessian_eqs.begin();
it != nonzero_hessian_eqs.end(); it++) it != nonzero_hessian_eqs.end(); it++)
{ {
if (it != nonzero_hessian_eqs.begin()) if (it != nonzero_hessian_eqs.begin())
@ -1759,7 +1759,7 @@ DynamicModel::Write_Inf_To_Bin_File_Block(const string &dynamic_basename, const
unsigned int block_size = getBlockSize(num); unsigned int block_size = getBlockSize(num);
unsigned int block_mfs = getBlockMfs(num); unsigned int block_mfs = getBlockMfs(num);
unsigned int block_recursive = block_size - block_mfs; unsigned int block_recursive = block_size - block_mfs;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++) for (auto it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -3018,17 +3018,17 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
set<int> exogenous; set<int> exogenous;
exogenous.clear(); exogenous.clear();
for (const auto & it : exo_block[block]) for (const auto & it : exo_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
exogenous.insert(*it1); exogenous.insert(*it1);
set<int> exogenous_det; set<int> exogenous_det;
exogenous_det.clear(); exogenous_det.clear();
for (const auto & it : exo_det_block[block]) for (const auto & it : exo_det_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
exogenous_det.insert(*it1); exogenous_det.insert(*it1);
set<int> other_endogenous; set<int> other_endogenous;
other_endogenous.clear(); other_endogenous.clear();
for (const auto & it : other_endo_block[block]) for (const auto & it : other_endo_block[block])
for (var_t::const_iterator it1 = it.second.begin(); it1 != it.second.end(); it1++) for (auto it1 = it.second.begin(); it1 != it.second.end(); it1++)
other_endogenous.insert(*it1); other_endogenous.insert(*it1);
output << "block_structure.block(" << block+1 << ").Simulation_Type = " << simulation_type << ";\n"; output << "block_structure.block(" << block+1 << ").Simulation_Type = " << simulation_type << ";\n";
output << "block_structure.block(" << block+1 << ").maximum_lag = " << max_lag << ";\n"; output << "block_structure.block(" << block+1 << ").maximum_lag = " << max_lag << ";\n";
@ -3195,7 +3195,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
for (int i = 0; i < block_size; i++) for (int i = 0; i < block_size; i++)
{ {
unsigned int eq = getBlockEquationID(block, i); unsigned int eq = getBlockEquationID(block, i);
derivative_t::const_iterator it = derivative_other_endo[block].find(make_pair(lag, make_pair(eq, other_endogenou))); auto it = derivative_other_endo[block].find(make_pair(lag, make_pair(eq, other_endogenou)));
if (it != derivative_other_endo[block].end()) if (it != derivative_other_endo[block].end())
{ {
count_lead_lag_incidence++; count_lead_lag_incidence++;
@ -3297,7 +3297,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
if (block == 0) if (block == 0)
{ {
set<pair<int, int> > row_state_var_incidence; set<pair<int, int> > row_state_var_incidence;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
vector<int>::const_iterator it_state_var = find(state_var.begin(), state_var.end(), getBlockVariableID(block, it->first.second)+1); vector<int>::const_iterator it_state_var = find(state_var.begin(), state_var.end(), getBlockVariableID(block, it->first.second)+1);
if (it_state_var != state_var.end()) if (it_state_var != state_var.end())
@ -3319,7 +3319,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin())); row_state_var_incidence.insert(make_pair(it_state_equ - state_equ.begin(), it_state_var - state_var.begin()));
} }
}*/ }*/
set<pair<int, int> >::const_iterator row_state_var_incidence_it = row_state_var_incidence.begin(); auto row_state_var_incidence_it = row_state_var_incidence.begin();
bool diag = true; bool diag = true;
int nb_diag_r = 0; int nb_diag_r = 0;
while (row_state_var_incidence_it != row_state_var_incidence.end() && diag) while (row_state_var_incidence_it != row_state_var_incidence.end() && diag)
@ -3337,7 +3337,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
set<pair<int, int> > col_state_var_incidence; set<pair<int, int> > col_state_var_incidence;
for (const auto & row_state_var_incidence_it : row_state_var_incidence) for (const auto & row_state_var_incidence_it : row_state_var_incidence)
col_state_var_incidence.insert(make_pair(row_state_var_incidence_it.second, row_state_var_incidence_it.first)); col_state_var_incidence.insert(make_pair(row_state_var_incidence_it.second, row_state_var_incidence_it.first));
set<pair<int, int> >::const_iterator col_state_var_incidence_it = col_state_var_incidence.begin(); auto col_state_var_incidence_it = col_state_var_incidence.begin();
diag = true; diag = true;
int nb_diag_c = 0; int nb_diag_c = 0;
while (col_state_var_incidence_it != col_state_var_incidence.end() && diag) while (col_state_var_incidence_it != col_state_var_incidence.end() && diag)
@ -3537,7 +3537,7 @@ DynamicModel::getVarModelVariablesFromEqTags(vector<string> &var_model_eqtags,
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
set<pair<int, int> >::const_iterator it = lhs_set.begin(); auto it = lhs_set.begin();
if (it->second != 0) if (it->second != 0)
{ {
cerr << "ERROR: in Equation " << eqtag cerr << "ERROR: in Equation " << eqtag
@ -3836,7 +3836,7 @@ DynamicModel::substitutePacExpectation()
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->substitutePacExpectation(subst_table)); auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substitutePacExpectation(subst_table));
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
} }
@ -4007,7 +4007,7 @@ DynamicModel::writeXrefs(ostream &output) const
<< "M_.xref1.exo = cell(1, M_.eq_nbr);" << endl << "M_.xref1.exo = cell(1, M_.eq_nbr);" << endl
<< "M_.xref1.exo_det = cell(1, M_.eq_nbr);" << endl; << "M_.xref1.exo_det = cell(1, M_.eq_nbr);" << endl;
int i = 1; int i = 1;
for (map<int, ExprNode::EquationInfo>::const_iterator it = xrefs.begin(); for (auto it = xrefs.begin();
it != xrefs.end(); it++, i++) it != xrefs.end(); it++, i++)
{ {
output << "M_.xref1.param{" << i << "} = [ "; output << "M_.xref1.param{" << i << "} = [ ";
@ -4054,7 +4054,7 @@ DynamicModel::writeRevXrefs(ostream &output, const map<pair<int, int>, set<int>
else else
last_tsid = tsid; last_tsid = tsid;
for (set<int>::const_iterator it1 = it.second.begin(); for (auto it1 = it.second.begin();
it1 != it.second.end(); it1++) it1 != it.second.end(); it1++)
if (type == "param") if (type == "param")
output << *it1 + 1 << " "; output << *it1 + 1 << " ";
@ -4244,7 +4244,7 @@ DynamicModel::collect_block_first_order_derivatives()
block_other_endo_index[block_eq][var] = 0; block_other_endo_index[block_eq][var] = 0;
else else
{ {
map<int, int>::const_iterator it1 = it->second.find(var); auto it1 = it->second.find(var);
if (it1 == it->second.end()) if (it1 == it->second.end())
{ {
int size = block_other_endo_index[block_eq].size(); int size = block_other_endo_index[block_eq].size();
@ -4273,7 +4273,7 @@ DynamicModel::collect_block_first_order_derivatives()
block_exo_index[block_eq][var] = 0; block_exo_index[block_eq][var] = 0;
else else
{ {
map<int, int>::const_iterator it1 = it->second.find(var); auto it1 = it->second.find(var);
if (it1 == it->second.end()) if (it1 == it->second.end())
{ {
int size = block_exo_index[block_eq].size(); int size = block_exo_index[block_eq].size();
@ -4301,7 +4301,7 @@ DynamicModel::collect_block_first_order_derivatives()
block_det_exo_index[block_eq][var] = 0; block_det_exo_index[block_eq][var] = 0;
else else
{ {
map<int, int>::const_iterator it1 = it->second.find(var); auto it1 = it->second.find(var);
if (it1 == it->second.end()) if (it1 == it->second.end())
{ {
int size = block_det_exo_index[block_eq].size(); int size = block_det_exo_index[block_eq].size();
@ -4506,7 +4506,7 @@ DynamicModel::computeRamseyPolicyFOCs(const StaticModel &static_model, const boo
int i; int i;
for (i = 0; i < (int) equations.size(); i++) for (i = 0; i < (int) equations.size(); i++)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i)); auto *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->addMultipliersToConstraints(i));
assert(substeq != NULL); assert(substeq != NULL);
equations[i] = substeq; equations[i] = substeq;
} }
@ -4802,7 +4802,7 @@ DynamicModel::getSymbIDByDerivID(int deriv_id) const throw (UnknownDerivIDExcept
int int
DynamicModel::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException) DynamicModel::getDerivID(int symb_id, int lag) const throw (UnknownDerivIDException)
{ {
deriv_id_table_t::const_iterator it = deriv_id_table.find(make_pair(symb_id, lag)); auto it = deriv_id_table.find(make_pair(symb_id, lag));
if (it == deriv_id_table.end()) if (it == deriv_id_table.end())
throw UnknownDerivIDException(); throw UnknownDerivIDException();
else else
@ -4874,7 +4874,7 @@ DynamicModel::computeDynJacobianCols(bool jacobianExo)
int int
DynamicModel::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException) DynamicModel::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException)
{ {
map<int, int>::const_iterator it = dyn_jacobian_cols_table.find(deriv_id); auto it = dyn_jacobian_cols_table.find(deriv_id);
if (it == dyn_jacobian_cols_table.end()) if (it == dyn_jacobian_cols_table.end())
throw UnknownDerivIDException(); throw UnknownDerivIDException();
else else
@ -4970,7 +4970,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
} }
int i = 1; int i = 1;
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin(); for (auto it = residuals_params_second_derivatives.begin();
it != residuals_params_second_derivatives.end(); ++it, i++) it != residuals_params_second_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -4994,7 +4994,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
} }
i = 1; i = 1;
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin(); for (auto it = jacobian_params_second_derivatives.begin();
it != jacobian_params_second_derivatives.end(); ++it, i++) it != jacobian_params_second_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -5022,7 +5022,7 @@ DynamicModel::writeParamsDerivativesFile(const string &basename, bool julia) con
} }
i = 1; i = 1;
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin(); for (auto it = hessian_params_derivatives.begin();
it != hessian_params_derivatives.end(); ++it, i++) it != hessian_params_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -5263,7 +5263,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl; cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst); auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
} }
@ -5296,7 +5296,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl; cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst); auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL); assert(substeq != NULL);
aux_equation = substeq; aux_equation = substeq;
} }
@ -5329,7 +5329,7 @@ DynamicModel::substituteLeadLagInternal(aux_var_t type, bool deterministic_model
cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl; cerr << "DynamicModel::substituteLeadLagInternal: impossible case" << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(subst); auto *substeq = dynamic_cast<BinaryOpNode *>(subst);
assert(substeq != NULL); assert(substeq != NULL);
diff_aux_equation = substeq; diff_aux_equation = substeq;
} }
@ -5402,7 +5402,7 @@ DynamicModel::substituteUnaryOps(StaticModel &static_model)
// Substitute in equations // Substitute in equations
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation-> auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs)); substituteUnaryOpNodes(static_model, nodes, subst_table, neweqs));
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
@ -5437,7 +5437,7 @@ DynamicModel::substituteDiff(StaticModel &static_model, ExprNode::subst_table_t
// Substitute in equations // Substitute in equations
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation-> auto *substeq = dynamic_cast<BinaryOpNode *>(equation->
substituteDiff(static_model, diff_table, diff_subst_table, neweqs)); substituteDiff(static_model, diff_table, diff_subst_table, neweqs));
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
@ -5472,7 +5472,7 @@ DynamicModel::substituteExpectation(bool partial_information_model)
// Substitute in equations // Substitute in equations
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->substituteExpectation(subst_table, neweqs, partial_information_model)); auto *substeq = dynamic_cast<BinaryOpNode *>(equation->substituteExpectation(subst_table, neweqs, partial_information_model));
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
} }
@ -5501,7 +5501,7 @@ DynamicModel::transformPredeterminedVariables()
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables()); auto *substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
assert(substeq != NULL); assert(substeq != NULL);
equation = substeq; equation = substeq;
} }
@ -5515,7 +5515,7 @@ DynamicModel::detrendEquations()
it != nonstationary_symbols_map.rend(); ++it) it != nonstationary_symbols_map.rend(); ++it)
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second)); auto *substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second));
assert(substeq != NULL); assert(substeq != NULL);
equation = dynamic_cast<BinaryOpNode *>(substeq); equation = dynamic_cast<BinaryOpNode *>(substeq);
} }
@ -5533,7 +5533,7 @@ DynamicModel::removeTrendVariableFromEquations()
{ {
for (auto & equation : equations) for (auto & equation : equations)
{ {
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar()); auto *substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar());
assert(substeq != NULL); assert(substeq != NULL);
equation = dynamic_cast<BinaryOpNode *>(substeq); equation = dynamic_cast<BinaryOpNode *>(substeq);
} }
@ -5552,7 +5552,7 @@ DynamicModel::fillEvalContext(eval_context_t &eval_context) const
for (auto aux_equation : aux_equations) for (auto aux_equation : aux_equations)
{ {
assert(aux_equation->get_op_code() == oEqual); assert(aux_equation->get_op_code() == oEqual);
VariableNode *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1()); auto *auxvar = dynamic_cast<VariableNode *>(aux_equation->get_arg1());
assert(auxvar != NULL); assert(auxvar != NULL);
try try
{ {
@ -5603,7 +5603,7 @@ DynamicModel::isModelLocalVariableUsed() const
void void
DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno, const vector<pair<string, string> > &eq_tags) DynamicModel::addStaticOnlyEquation(expr_t eq, int lineno, const vector<pair<string, string> > &eq_tags)
{ {
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq); auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual); assert(beq != NULL && beq->get_op_code() == oEqual);
vector<pair<string, string> > soe_eq_tags; vector<pair<string, string> > soe_eq_tags;
@ -5785,7 +5785,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
<< "size_t nback = " << zeta_back.size() << ";" << endl << "size_t nback = " << zeta_back.size() << ";" << endl
<< "size_t nmixed = " << zeta_mixed.size() << ";" << endl; << "size_t nmixed = " << zeta_mixed.size() << ";" << endl;
output << "size_t zeta_static[" << zeta_static.size() << "] = {"; output << "size_t zeta_static[" << zeta_static.size() << "] = {";
for (vector<int>::iterator i = zeta_static.begin(); i != zeta_static.end(); ++i) for (auto i = zeta_static.begin(); i != zeta_static.end(); ++i)
{ {
if (i != zeta_static.begin()) if (i != zeta_static.begin())
output << ","; output << ",";
@ -5794,7 +5794,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
output << "};" << endl; output << "};" << endl;
output << "size_t zeta_back[" << zeta_back.size() << "] = {"; output << "size_t zeta_back[" << zeta_back.size() << "] = {";
for (vector<int>::iterator i = zeta_back.begin(); i != zeta_back.end(); ++i) for (auto i = zeta_back.begin(); i != zeta_back.end(); ++i)
{ {
if (i != zeta_back.begin()) if (i != zeta_back.begin())
output << ","; output << ",";
@ -5803,7 +5803,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
output << "};" << endl; output << "};" << endl;
output << "size_t zeta_fwrd[" << zeta_fwrd.size() << "] = {"; output << "size_t zeta_fwrd[" << zeta_fwrd.size() << "] = {";
for (vector<int>::iterator i = zeta_fwrd.begin(); i != zeta_fwrd.end(); ++i) for (auto i = zeta_fwrd.begin(); i != zeta_fwrd.end(); ++i)
{ {
if (i != zeta_fwrd.begin()) if (i != zeta_fwrd.begin())
output << ","; output << ",";
@ -5812,7 +5812,7 @@ DynamicModel::writeCOutput(ostream &output, const string &basename, bool block_d
output << "};" << endl; output << "};" << endl;
output << "size_t zeta_mixed[" << zeta_mixed.size() << "] = {"; output << "size_t zeta_mixed[" << zeta_mixed.size() << "] = {";
for (vector<int>::iterator i = zeta_mixed.begin(); i != zeta_mixed.end(); ++i) for (auto i = zeta_mixed.begin(); i != zeta_mixed.end(); ++i)
{ {
if (i != zeta_mixed.begin()) if (i != zeta_mixed.begin())
output << ","; output << ",";
@ -6343,7 +6343,7 @@ DynamicModel::writeJsonOutput(ostream &output) const
void void
DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, set<int> > &xrefs) const DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, set<int> > &xrefs) const
{ {
for (map<pair<int, int>, set<int> >::const_iterator it = xrefs.begin(); for (auto it = xrefs.begin();
it != xrefs.end(); it++) it != xrefs.end(); it++)
{ {
if (it != xrefs.begin()) if (it != xrefs.begin())
@ -6351,7 +6351,7 @@ DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, se
output << "{\"name\": \"" << symbol_table.getName(it->first.first) << "\"" output << "{\"name\": \"" << symbol_table.getName(it->first.first) << "\""
<< ", \"shift\": " << it->first.second << ", \"shift\": " << it->first.second
<< ", \"equations\": ["; << ", \"equations\": [";
for (set<int>::const_iterator it1 = it->second.begin(); for (auto it1 = it->second.begin();
it1 != it->second.end(); it1++) it1 != it->second.end(); it1++)
{ {
if (it1 != it->second.begin()) if (it1 != it->second.begin())
@ -6488,7 +6488,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
<< " \"nrows\": " << equations.size() << " \"nrows\": " << equations.size()
<< ", \"ncols\": " << dynJacobianColsNbr << ", \"ncols\": " << dynJacobianColsNbr
<< ", \"entries\": ["; << ", \"entries\": [";
for (first_derivatives_t::const_iterator it = first_derivatives.begin(); for (auto it = first_derivatives.begin();
it != first_derivatives.end(); it++) it != first_derivatives.end(); it++)
{ {
if (it != first_derivatives.begin()) if (it != first_derivatives.begin())
@ -6525,7 +6525,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
<< " \"nrows\": " << equations.size() << " \"nrows\": " << equations.size()
<< ", \"ncols\": " << hessianColsNbr << ", \"ncols\": " << hessianColsNbr
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = second_derivatives.begin(); for (auto it = second_derivatives.begin();
it != second_derivatives.end(); it++) it != second_derivatives.end(); it++)
{ {
if (it != second_derivatives.begin()) if (it != second_derivatives.begin())
@ -6571,7 +6571,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
<< " \"nrows\": " << equations.size() << " \"nrows\": " << equations.size()
<< ", \"ncols\": " << hessianColsNbr * dynJacobianColsNbr << ", \"ncols\": " << hessianColsNbr * dynJacobianColsNbr
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = third_derivatives.begin(); for (auto it = third_derivatives.begin();
it != third_derivatives.end(); it++) it != third_derivatives.end(); it++)
{ {
if (it != third_derivatives.begin()) if (it != third_derivatives.begin())
@ -6600,7 +6600,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
cols.insert(id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1); cols.insert(id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1);
third_derivatives_output << ", \"col\": ["; third_derivatives_output << ", \"col\": [";
for (set<int>::iterator it2 = cols.begin(); it2 != cols.end(); it2++) for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
{ {
if (it2 != cols.begin()) if (it2 != cols.begin())
third_derivatives_output << ", "; third_derivatives_output << ", ";
@ -6662,7 +6662,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< " \"neqs\": " << equations.size() << " \"neqs\": " << equations.size()
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin(); for (auto it = residuals_params_derivatives.begin();
it != residuals_params_derivatives.end(); it++) it != residuals_params_derivatives.end(); it++)
{ {
if (it != residuals_params_derivatives.begin()) if (it != residuals_params_derivatives.begin())
@ -6694,7 +6694,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nvarcols\": " << dynJacobianColsNbr << ", \"nvarcols\": " << dynJacobianColsNbr
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = jacobian_params_derivatives.begin(); for (auto it = jacobian_params_derivatives.begin();
it != jacobian_params_derivatives.end(); it++) it != jacobian_params_derivatives.end(); it++)
{ {
if (it != jacobian_params_derivatives.begin()) if (it != jacobian_params_derivatives.begin())
@ -6732,7 +6732,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nparam1cols\": " << symbol_table.param_nbr() << ", \"nparam1cols\": " << symbol_table.param_nbr()
<< ", \"nparam2cols\": " << symbol_table.param_nbr() << ", \"nparam2cols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin(); for (auto it = residuals_params_second_derivatives.begin();
it != residuals_params_second_derivatives.end(); ++it) it != residuals_params_second_derivatives.end(); ++it)
{ {
if (it != residuals_params_second_derivatives.begin()) if (it != residuals_params_second_derivatives.begin())
@ -6768,7 +6768,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nparam1cols\": " << symbol_table.param_nbr() << ", \"nparam1cols\": " << symbol_table.param_nbr()
<< ", \"nparam2cols\": " << symbol_table.param_nbr() << ", \"nparam2cols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin(); for (auto it = jacobian_params_second_derivatives.begin();
it != jacobian_params_second_derivatives.end(); ++it) it != jacobian_params_second_derivatives.end(); ++it)
{ {
if (it != jacobian_params_second_derivatives.begin()) if (it != jacobian_params_second_derivatives.begin())
@ -6811,7 +6811,7 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nvar2cols\": " << dynJacobianColsNbr << ", \"nvar2cols\": " << dynJacobianColsNbr
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin(); for (auto it = hessian_params_derivatives.begin();
it != hessian_params_derivatives.end(); ++it) it != hessian_params_derivatives.end(); ++it)
{ {
if (it != hessian_params_derivatives.begin()) if (it != hessian_params_derivatives.begin())

View File

@ -543,7 +543,7 @@ public:
virtual int virtual int
getBlockVariableExoID(int block_number, int variable_number) const getBlockVariableExoID(int block_number, int variable_number) const
{ {
map<int, var_t>::const_iterator it = exo_block[block_number].find(variable_number); auto it = exo_block[block_number].find(variable_number);
return (it->first); return (it->first);
}; };
//! Return the position of equation_number in the block number belonging to the block block_number //! Return the position of equation_number in the block number belonging to the block block_number
@ -568,10 +568,10 @@ public:
virtual int virtual int
getBlockInitialExogenousID(int block_number, int variable_number) const getBlockInitialExogenousID(int block_number, int variable_number) const
{ {
map< int, map<int, int> >::const_iterator it = block_exo_index.find(block_number); auto it = block_exo_index.find(block_number);
if (it != block_exo_index.end()) if (it != block_exo_index.end())
{ {
map<int, int>::const_iterator it1 = it->second.find(variable_number); auto it1 = it->second.find(variable_number);
if (it1 != it->second.end()) if (it1 != it->second.end())
return it1->second; return it1->second;
else else
@ -584,10 +584,10 @@ public:
virtual int virtual int
getBlockInitialDetExogenousID(int block_number, int variable_number) const getBlockInitialDetExogenousID(int block_number, int variable_number) const
{ {
map< int, map<int, int> >::const_iterator it = block_det_exo_index.find(block_number); auto it = block_det_exo_index.find(block_number);
if (it != block_det_exo_index.end()) if (it != block_det_exo_index.end())
{ {
map<int, int>::const_iterator it1 = it->second.find(variable_number); auto it1 = it->second.find(variable_number);
if (it1 != it->second.end()) if (it1 != it->second.end())
return it1->second; return it1->second;
else else
@ -600,10 +600,10 @@ public:
virtual int virtual int
getBlockInitialOtherEndogenousID(int block_number, int variable_number) const getBlockInitialOtherEndogenousID(int block_number, int variable_number) const
{ {
map< int, map<int, int> >::const_iterator it = block_other_endo_index.find(block_number); auto it = block_other_endo_index.find(block_number);
if (it != block_other_endo_index.end()) if (it != block_other_endo_index.end())
{ {
map<int, int>::const_iterator it1 = it->second.find(variable_number); auto it1 = it->second.find(variable_number);
if (it1 != it->second.end()) if (it1 != it->second.end())
return it1->second; return it1->second;
else else

View File

@ -51,7 +51,7 @@ ExprNode::getDerivative(int deriv_id)
prepareForDerivation(); prepareForDerivation();
// Return zero if derivative is necessarily null (using symbolic a priori) // Return zero if derivative is necessarily null (using symbolic a priori)
set<int>::const_iterator it = non_null_derivatives.find(deriv_id); auto it = non_null_derivatives.find(deriv_id);
if (it == non_null_derivatives.end()) if (it == non_null_derivatives.end())
return datatree.Zero; return datatree.Zero;
@ -353,7 +353,7 @@ NumConstNode::computeDerivative(int deriv_id)
void void
NumConstNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const NumConstNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<NumConstNode *>(this)); auto it = temporary_terms.find(const_cast<NumConstNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
} }
@ -759,7 +759,7 @@ VariableNode::computeDerivative(int deriv_id)
void void
VariableNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const VariableNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this)); auto it = temporary_terms.find(const_cast<VariableNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
if (type == eModelLocalVariable) if (type == eModelLocalVariable)
@ -778,7 +778,7 @@ VariableNode::writeJsonOutput(ostream &output,
const deriv_node_temp_terms_t &tef_terms, const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this)); auto it = temporary_terms.find(const_cast<VariableNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -1052,7 +1052,7 @@ VariableNode::substituteStaticAuxiliaryVariable() const
double double
VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) VariableNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
{ {
eval_context_t::const_iterator it = eval_context.find(symb_id); auto it = eval_context.find(symb_id);
if (it == eval_context.end()) if (it == eval_context.end())
throw EvalException(); throw EvalException();
@ -1214,7 +1214,7 @@ VariableNode::getChainRuleDerivative(int deriv_id, const map<int, expr_t> &recur
else else
{ {
//if there is in the equation a recursive variable we could use a chaine rule derivation //if there is in the equation a recursive variable we could use a chaine rule derivation
map<int, expr_t>::const_iterator it = recursive_variables.find(datatree.getDerivID(symb_id, lag)); auto it = recursive_variables.find(datatree.getDerivID(symb_id, lag));
if (it != recursive_variables.end()) if (it != recursive_variables.end())
{ {
map<int, expr_t>::const_iterator it2 = derivatives.find(deriv_id); map<int, expr_t>::const_iterator it2 = derivatives.find(deriv_id);
@ -1649,7 +1649,7 @@ VariableNode::differentiateForwardVars(const vector<string> &subset, subst_table
return const_cast<VariableNode *>(this); return const_cast<VariableNode *>(this);
else else
{ {
subst_table_t::iterator it = subst_table.find(this); auto it = subst_table.find(this);
VariableNode *diffvar; VariableNode *diffvar;
if (it != subst_table.end()) if (it != subst_table.end())
diffvar = const_cast<VariableNode *>(it->second); diffvar = const_cast<VariableNode *>(it->second);
@ -1939,7 +1939,7 @@ UnaryOpNode::composeDerivatives(expr_t darg, int deriv_id)
{ {
if (datatree.getTypeByDerivID(deriv_id) == eParameter) if (datatree.getTypeByDerivID(deriv_id) == eParameter)
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
if (varg == NULL) if (varg == NULL)
{ {
cerr << "UnaryOpNode::composeDerivatives: STEADY_STATE() should only be used on " cerr << "UnaryOpNode::composeDerivatives: STEADY_STATE() should only be used on "
@ -1960,7 +1960,7 @@ UnaryOpNode::composeDerivatives(expr_t darg, int deriv_id)
assert(datatree.isDynamic()); assert(datatree.isDynamic());
if (datatree.getTypeByDerivID(deriv_id) == eParameter) if (datatree.getTypeByDerivID(deriv_id) == eParameter)
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
assert(varg != NULL); assert(varg != NULL);
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous); assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
return datatree.AddSteadyStateParam2ndDeriv(arg, param1_symb_id, datatree.getSymbIDByDerivID(deriv_id)); return datatree.AddSteadyStateParam2ndDeriv(arg, param1_symb_id, datatree.getSymbIDByDerivID(deriv_id));
@ -2143,7 +2143,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &r
{ {
expr_t this2 = const_cast<UnaryOpNode *>(this); expr_t this2 = const_cast<UnaryOpNode *>(this);
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
reference_count[this2] = make_pair(1, tr); reference_count[this2] = make_pair(1, tr);
@ -2166,7 +2166,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
int equation) const int equation) const
{ {
expr_t this2 = const_cast<UnaryOpNode *>(this); expr_t this2 = const_cast<UnaryOpNode *>(this);
map<expr_t, int>::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
reference_count[this2] = 1; reference_count[this2] = 1;
@ -2187,7 +2187,7 @@ UnaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
void void
UnaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const UnaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
else else
@ -2206,7 +2206,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
const deriv_node_temp_terms_t &tef_terms, const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -2283,7 +2283,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
output << "adl("; output << "adl(";
arg->writeJsonOutput(output, temporary_terms, tef_terms); arg->writeJsonOutput(output, temporary_terms, tef_terms);
output << ", '" << adl_param_name << "', ["; output << ", '" << adl_param_name << "', [";
for (vector<int>::const_iterator it = adl_lags.begin(); it != adl_lags.end(); it++) for (auto it = adl_lags.begin(); it != adl_lags.end(); it++)
{ {
if (it != adl_lags.begin()) if (it != adl_lags.begin())
output << ", "; output << ", ";
@ -2298,7 +2298,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
return; return;
case oSteadyStateParamDeriv: case oSteadyStateParamDeriv:
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
assert(varg != NULL); assert(varg != NULL);
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous); assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter); assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
@ -2309,7 +2309,7 @@ UnaryOpNode::writeJsonOutput(ostream &output,
return; return;
case oSteadyStateParam2ndDeriv: case oSteadyStateParam2ndDeriv:
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
assert(varg != NULL); assert(varg != NULL);
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous); assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter); assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
@ -2464,7 +2464,7 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
return; return;
case oSteadyStateParamDeriv: case oSteadyStateParamDeriv:
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
assert(varg != NULL); assert(varg != NULL);
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous); assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter); assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
@ -2476,7 +2476,7 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
return; return;
case oSteadyStateParam2ndDeriv: case oSteadyStateParam2ndDeriv:
{ {
VariableNode *varg = dynamic_cast<VariableNode *>(arg); auto *varg = dynamic_cast<VariableNode *>(arg);
assert(varg != NULL); assert(varg != NULL);
assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous); assert(datatree.symbol_table.getType(varg->symb_id) == eEndogenous);
assert(datatree.symbol_table.getType(param1_symb_id) == eParameter); assert(datatree.symbol_table.getType(param1_symb_id) == eParameter);
@ -2645,18 +2645,18 @@ UnaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
if (dynamic) if (dynamic)
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDT_ fldt(ii->second); FLDT_ fldt(ii->second);
fldt.write(CompileCode, instruction_number); fldt.write(CompileCode, instruction_number);
} }
else else
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDST_ fldst(ii->second); FLDST_ fldst(ii->second);
fldst.write(CompileCode, instruction_number); fldst.write(CompileCode, instruction_number);
} }
@ -2966,7 +2966,7 @@ UnaryOpNode::VarMaxLag(DataTree &static_datatree, set<expr_t> &static_lhs, int &
arg->VarMaxLag(static_datatree, static_lhs, max_lag); arg->VarMaxLag(static_datatree, static_lhs, max_lag);
else else
{ {
set<expr_t>::const_iterator it = static_lhs.find(this->toStatic(static_datatree)); auto it = static_lhs.find(this->toStatic(static_datatree));
if (it != static_lhs.end()) if (it != static_lhs.end())
{ {
int max_lag_tmp = arg->maxLag() - arg->countDiffs(); int max_lag_tmp = arg->maxLag() - arg->countDiffs();
@ -3009,7 +3009,7 @@ UnaryOpNode::substituteAdl() const
expr_t retval = NULL; expr_t retval = NULL;
ostringstream inttostr; ostringstream inttostr;
for (vector<int>::const_iterator it = adl_lags.begin(); it != adl_lags.end(); it++) for (auto it = adl_lags.begin(); it != adl_lags.end(); it++)
if (it == adl_lags.begin()) if (it == adl_lags.begin())
{ {
inttostr << *it; inttostr << *it;
@ -3078,7 +3078,7 @@ UnaryOpNode::findUnaryOpNodesForAuxVarCreation(DataTree &static_datatree, diff_t
expr_t sthis = this->toStatic(static_datatree); expr_t sthis = this->toStatic(static_datatree);
int arg_max_lag = -arg->maxLag(); int arg_max_lag = -arg->maxLag();
diff_table_t::iterator it = nodes.find(sthis); auto it = nodes.find(sthis);
if (it != nodes.end()) if (it != nodes.end())
{ {
for (map<int, expr_t>::const_iterator it1 = it->second.begin(); for (map<int, expr_t>::const_iterator it1 = it->second.begin();
@ -3101,7 +3101,7 @@ UnaryOpNode::findDiffNodes(DataTree &static_datatree, diff_table_t &diff_table)
expr_t sthis = this->toStatic(static_datatree); expr_t sthis = this->toStatic(static_datatree);
int arg_max_lag = -arg->maxLag(); int arg_max_lag = -arg->maxLag();
diff_table_t::iterator it = diff_table.find(sthis); auto it = diff_table.find(sthis);
if (it != diff_table.end()) if (it != diff_table.end())
{ {
for (map<int, expr_t>::const_iterator it1 = it->second.begin(); for (map<int, expr_t>::const_iterator it1 = it->second.begin();
@ -3129,7 +3129,7 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
return const_cast<VariableNode *>(sit->second); return const_cast<VariableNode *>(sit->second);
expr_t sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree)); expr_t sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree));
diff_table_t::iterator it = diff_table.find(sthis); auto it = diff_table.find(sthis);
if (it == diff_table.end() || it->second[-arg->maxLag()] != this) if (it == diff_table.end() || it->second[-arg->maxLag()] != this)
{ {
cerr << "Internal error encountered. Please report" << endl; cerr << "Internal error encountered. Please report" << endl;
@ -3138,13 +3138,13 @@ UnaryOpNode::substituteDiff(DataTree &static_datatree, diff_table_t &diff_table,
int last_arg_max_lag = 0; int last_arg_max_lag = 0;
VariableNode *last_aux_var = NULL; VariableNode *last_aux_var = NULL;
for (map<int, expr_t>::reverse_iterator rit = it->second.rbegin(); for (auto rit = it->second.rbegin();
rit != it->second.rend(); rit++) rit != it->second.rend(); rit++)
{ {
expr_t argsubst = dynamic_cast<UnaryOpNode *>(rit->second)-> expr_t argsubst = dynamic_cast<UnaryOpNode *>(rit->second)->
get_arg()->substituteDiff(static_datatree, diff_table, subst_table, neweqs); get_arg()->substituteDiff(static_datatree, diff_table, subst_table, neweqs);
int symb_id; int symb_id;
VariableNode *vn = dynamic_cast<VariableNode *>(argsubst); auto *vn = dynamic_cast<VariableNode *>(argsubst);
if (rit == it->second.rbegin()) if (rit == it->second.rbegin())
{ {
if (vn != NULL) if (vn != NULL)
@ -3198,8 +3198,8 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
if (sit != subst_table.end()) if (sit != subst_table.end())
return const_cast<VariableNode *>(sit->second); return const_cast<VariableNode *>(sit->second);
UnaryOpNode *sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree)); auto *sthis = dynamic_cast<UnaryOpNode *>(this->toStatic(static_datatree));
diff_table_t::iterator it = nodes.find(sthis); auto it = nodes.find(sthis);
if (it == nodes.end()) if (it == nodes.end())
{ {
expr_t argsubst = arg->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs); expr_t argsubst = arg->substituteUnaryOpNodes(static_datatree, nodes, subst_table, neweqs);
@ -3207,12 +3207,12 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
} }
VariableNode *aux_var = NULL; VariableNode *aux_var = NULL;
for (map<int, expr_t>::reverse_iterator rit = it->second.rbegin(); for (auto rit = it->second.rbegin();
rit != it->second.rend(); rit++) rit != it->second.rend(); rit++)
{ {
if (rit == it->second.rbegin()) if (rit == it->second.rbegin())
{ {
VariableNode *vn = dynamic_cast<VariableNode *>(const_cast<UnaryOpNode *>(this)->get_arg()); auto *vn = dynamic_cast<VariableNode *>(const_cast<UnaryOpNode *>(this)->get_arg());
int symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, const_cast<UnaryOpNode *>(this), int symb_id = datatree.symbol_table.addUnaryOpAuxiliaryVar(this->idx, const_cast<UnaryOpNode *>(this),
vn->get_symb_id(), vn->get_lag()); vn->get_symb_id(), vn->get_lag());
aux_var = datatree.AddVariable(symb_id, 0); aux_var = datatree.AddVariable(symb_id, 0);
@ -3221,7 +3221,7 @@ UnaryOpNode::substituteUnaryOpNodes(DataTree &static_datatree, diff_table_t &nod
} }
else else
{ {
VariableNode *vn = dynamic_cast<VariableNode *>(dynamic_cast<UnaryOpNode *>(rit->second)->get_arg()); auto *vn = dynamic_cast<VariableNode *>(dynamic_cast<UnaryOpNode *>(rit->second)->get_arg());
subst_table[rit->second] = dynamic_cast<VariableNode *>(aux_var->decreaseLeadsLags(-vn->get_lag())); subst_table[rit->second] = dynamic_cast<VariableNode *>(aux_var->decreaseLeadsLags(-vn->get_lag()));
} }
} }
@ -3304,7 +3304,7 @@ UnaryOpNode::substituteExpectation(subst_table_t &subst_table, vector<BinaryOpNo
{ {
if (op_code == oExpectation) if (op_code == oExpectation)
{ {
subst_table_t::iterator it = subst_table.find(const_cast<UnaryOpNode *>(this)); auto it = subst_table.find(const_cast<UnaryOpNode *>(this));
if (it != subst_table.end()) if (it != subst_table.end())
return const_cast<VariableNode *>(it->second); return const_cast<VariableNode *>(it->second);
@ -3636,7 +3636,7 @@ BinaryOpNode::computeDerivative(int deriv_id)
int int
BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
// A temporary term behaves as a variable // A temporary term behaves as a variable
if (it != temporary_terms.end()) if (it != temporary_terms.end())
return 100; return 100;
@ -3677,7 +3677,7 @@ BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t
int int
BinaryOpNode::precedenceJson(const temporary_terms_t &temporary_terms) const BinaryOpNode::precedenceJson(const temporary_terms_t &temporary_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
// A temporary term behaves as a variable // A temporary term behaves as a variable
if (it != temporary_terms.end()) if (it != temporary_terms.end())
return 100; return 100;
@ -3802,7 +3802,7 @@ BinaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &
bool is_matlab, NodeTreeReference tr) const bool is_matlab, NodeTreeReference tr) const
{ {
expr_t this2 = const_cast<BinaryOpNode *>(this); expr_t this2 = const_cast<BinaryOpNode *>(this);
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
// If this node has never been encountered, set its ref count to one, // If this node has never been encountered, set its ref count to one,
@ -3832,7 +3832,7 @@ BinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
int equation) const int equation) const
{ {
expr_t this2 = const_cast<BinaryOpNode *>(this); expr_t this2 = const_cast<BinaryOpNode *>(this);
map<expr_t, int>::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
reference_count[this2] = 1; reference_count[this2] = 1;
@ -3924,18 +3924,18 @@ BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
if (dynamic) if (dynamic)
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDT_ fldt(ii->second); FLDT_ fldt(ii->second);
fldt.write(CompileCode, instruction_number); fldt.write(CompileCode, instruction_number);
} }
else else
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDST_ fldst(ii->second); FLDST_ fldst(ii->second);
fldst.write(CompileCode, instruction_number); fldst.write(CompileCode, instruction_number);
} }
@ -3955,7 +3955,7 @@ BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
void void
BinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const BinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
else else
@ -3979,7 +3979,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
const bool isdynamic) const const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -4022,7 +4022,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
// If left argument has a lower precedence, or if current and left argument are both power operators, // If left argument has a lower precedence, or if current and left argument are both power operators,
// add parenthesis around left argument // add parenthesis around left argument
BinaryOpNode *barg1 = dynamic_cast<BinaryOpNode *>(arg1); auto *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
if (arg1->precedenceJson(temporary_terms) < prec if (arg1->precedenceJson(temporary_terms) < prec
|| (op_code == oPower && barg1 != NULL && barg1->op_code == oPower)) || (op_code == oPower && barg1 != NULL && barg1->op_code == oPower))
{ {
@ -4086,7 +4086,7 @@ BinaryOpNode::writeJsonOutput(ostream &output,
- it is a power operator and current operator is also a power operator - it is a power operator and current operator is also a power operator
- it is a minus operator with same precedence than current operator - it is a minus operator with same precedence than current operator
- it is a divide operator with same precedence than current operator */ - it is a divide operator with same precedence than current operator */
BinaryOpNode *barg2 = dynamic_cast<BinaryOpNode *>(arg2); auto *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
int arg2_prec = arg2->precedenceJson(temporary_terms); int arg2_prec = arg2->precedenceJson(temporary_terms);
if (arg2_prec < prec if (arg2_prec < prec
|| (op_code == oPower && barg2 != NULL && barg2->op_code == oPower) || (op_code == oPower && barg2 != NULL && barg2->op_code == oPower)
@ -4165,7 +4165,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
else else
{ {
// If left argument has a lower precedence, or if current and left argument are both power operators, add parenthesis around left argument // If left argument has a lower precedence, or if current and left argument are both power operators, add parenthesis around left argument
BinaryOpNode *barg1 = dynamic_cast<BinaryOpNode *>(arg1); auto *barg1 = dynamic_cast<BinaryOpNode *>(arg1);
if (arg1->precedence(output_type, temporary_terms) < prec if (arg1->precedence(output_type, temporary_terms) < prec
|| (op_code == oPower && barg1 != NULL && barg1->op_code == oPower)) || (op_code == oPower && barg1 != NULL && barg1->op_code == oPower))
{ {
@ -4255,7 +4255,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
- it is a power operator and current operator is also a power operator - it is a power operator and current operator is also a power operator
- it is a minus operator with same precedence than current operator - it is a minus operator with same precedence than current operator
- it is a divide operator with same precedence than current operator */ - it is a divide operator with same precedence than current operator */
BinaryOpNode *barg2 = dynamic_cast<BinaryOpNode *>(arg2); auto *barg2 = dynamic_cast<BinaryOpNode *>(arg2);
int arg2_prec = arg2->precedence(output_type, temporary_terms); int arg2_prec = arg2->precedence(output_type, temporary_terms);
if (arg2_prec < prec if (arg2_prec < prec
|| (op_code == oPower && barg2 != NULL && barg2->op_code == oPower && !IS_LATEX(output_type)) || (op_code == oPower && barg2 != NULL && barg2->op_code == oPower && !IS_LATEX(output_type))
@ -5030,11 +5030,11 @@ BinaryOpNode::walkPacParametersHelper(const expr_t arg1, const expr_t arg2,
ar_params_and_vars.insert(make_pair(*(params.begin()), *(endogs.begin()))); ar_params_and_vars.insert(make_pair(*(params.begin()), *(endogs.begin())));
else if (endogs.size() >= 2) else if (endogs.size() >= 2)
{ {
BinaryOpNode *testarg2 = dynamic_cast<BinaryOpNode *>(arg2); auto *testarg2 = dynamic_cast<BinaryOpNode *>(arg2);
if (testarg2 != NULL && testarg2->get_op_code() == oMinus) if (testarg2 != NULL && testarg2->get_op_code() == oMinus)
{ {
VariableNode *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1()); auto *test_arg1 = dynamic_cast<VariableNode *>(testarg2->get_arg1());
VariableNode *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2()); auto *test_arg2 = dynamic_cast<VariableNode *>(testarg2->get_arg2());
if (test_arg1 != NULL && test_arg2 != NULL && lhs.first != -1) if (test_arg1 != NULL && test_arg2 != NULL && lhs.first != -1)
{ {
test_arg1->collectDynamicVariables(eEndogenous, endogs); test_arg1->collectDynamicVariables(eEndogenous, endogs);
@ -5232,7 +5232,7 @@ TrinaryOpNode::computeDerivative(int deriv_id)
int int
TrinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const TrinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
// A temporary term behaves as a variable // A temporary term behaves as a variable
if (it != temporary_terms.end()) if (it != temporary_terms.end())
return 100; return 100;
@ -5305,7 +5305,7 @@ TrinaryOpNode::computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> >
bool is_matlab, NodeTreeReference tr) const bool is_matlab, NodeTreeReference tr) const
{ {
expr_t this2 = const_cast<TrinaryOpNode *>(this); expr_t this2 = const_cast<TrinaryOpNode *>(this);
map<expr_t, pair<int, NodeTreeReference > >::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
// If this node has never been encountered, set its ref count to one, // If this node has never been encountered, set its ref count to one,
@ -5334,7 +5334,7 @@ TrinaryOpNode::computeTemporaryTerms(map<expr_t, int> &reference_count,
int equation) const int equation) const
{ {
expr_t this2 = const_cast<TrinaryOpNode *>(this); expr_t this2 = const_cast<TrinaryOpNode *>(this);
map<expr_t, int>::iterator it = reference_count.find(this2); auto it = reference_count.find(this2);
if (it == reference_count.end()) if (it == reference_count.end())
{ {
reference_count[this2] = 1; reference_count[this2] = 1;
@ -5385,18 +5385,18 @@ TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
if (dynamic) if (dynamic)
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDT_ fldt(ii->second); FLDT_ fldt(ii->second);
fldt.write(CompileCode, instruction_number); fldt.write(CompileCode, instruction_number);
} }
else else
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDST_ fldst(ii->second); FLDST_ fldst(ii->second);
fldst.write(CompileCode, instruction_number); fldst.write(CompileCode, instruction_number);
} }
@ -5412,7 +5412,7 @@ TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
void void
TrinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const TrinaryOpNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
else else
@ -5438,7 +5438,7 @@ TrinaryOpNode::writeJsonOutput(ostream &output,
const bool isdynamic) const const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this)); auto it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -6045,7 +6045,7 @@ AbstractExternalFunctionNode::collectDynamicVariables(SymbolType type_arg, set<p
void void
AbstractExternalFunctionNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const AbstractExternalFunctionNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<AbstractExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<AbstractExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
else else
@ -6284,7 +6284,7 @@ AbstractExternalFunctionNode::differentiateForwardVars(const vector<string> &sub
bool bool
AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const
{ {
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments)); auto it = tef_terms.find(make_pair(the_symb_id, arguments));
if (it != tef_terms.end()) if (it != tef_terms.end())
return true; return true;
return false; return false;
@ -6293,7 +6293,7 @@ AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const der
int int
AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs) AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs)
{ {
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments)); auto it = tef_terms.find(make_pair(the_symb_id, arguments));
if (it != tef_terms.end()) if (it != tef_terms.end())
return it->second; return it->second;
throw UnknownFunctionNameAndArgs(); throw UnknownFunctionNameAndArgs();
@ -6463,7 +6463,7 @@ AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, Ex
const temporary_terms_idxs_t &temporary_terms_idxs, const temporary_terms_idxs_t &temporary_terms_idxs,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
for (vector<expr_t>::const_iterator it = arguments.begin(); for (auto it = arguments.begin();
it != arguments.end(); it++) it != arguments.end(); it++)
{ {
if (it != arguments.begin()) if (it != arguments.begin())
@ -6479,7 +6479,7 @@ AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output
const deriv_node_temp_terms_t &tef_terms, const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const const bool isdynamic) const
{ {
for (vector<expr_t>::const_iterator it = arguments.begin(); for (auto it = arguments.begin();
it != arguments.end(); it++) it != arguments.end(); it++)
{ {
if (it != arguments.begin()) if (it != arguments.begin())
@ -6563,18 +6563,18 @@ ExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_nu
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
if (dynamic) if (dynamic)
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDT_ fldt(ii->second); FLDT_ fldt(ii->second);
fldt.write(CompileCode, instruction_number); fldt.write(CompileCode, instruction_number);
} }
else else
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDST_ fldst(ii->second); FLDST_ fldst(ii->second);
fldst.write(CompileCode, instruction_number); fldst.write(CompileCode, instruction_number);
} }
@ -6649,7 +6649,7 @@ ExternalFunctionNode::writeJsonOutput(ostream &output,
const deriv_node_temp_terms_t &tef_terms, const deriv_node_temp_terms_t &tef_terms,
const bool isdynamic) const const bool isdynamic) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -6886,7 +6886,7 @@ FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output,
const bool isdynamic) const const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -6953,18 +6953,18 @@ FirstDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &inst
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
const deriv_node_temp_terms_t &tef_terms) const const deriv_node_temp_terms_t &tef_terms) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
if (dynamic) if (dynamic)
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDT_ fldt(ii->second); FLDT_ fldt(ii->second);
fldt.write(CompileCode, instruction_number); fldt.write(CompileCode, instruction_number);
} }
else else
{ {
map_idx_t::const_iterator ii = map_idx.find(idx); auto ii = map_idx.find(idx);
FLDST_ fldst(ii->second); FLDST_ fldst(ii->second);
fldst.write(CompileCode, instruction_number); fldst.write(CompileCode, instruction_number);
} }
@ -7267,7 +7267,7 @@ SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output,
const bool isdynamic) const const bool isdynamic) const
{ {
// If current node is a temporary term // If current node is a temporary term
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this)); auto it = temporary_terms.find(const_cast<SecondDerivExternalFunctionNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
{ {
output << "T" << idx; output << "T" << idx;
@ -7722,7 +7722,7 @@ VarExpectationNode::containsExternalFunction() const
double double
VarExpectationNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) VarExpectationNode::eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException)
{ {
eval_context_t::const_iterator it = eval_context.find(symb_id); auto it = eval_context.find(symb_id);
if (it == eval_context.end()) if (it == eval_context.end())
throw EvalException(); throw EvalException();
@ -7755,7 +7755,7 @@ VarExpectationNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, i
void void
VarExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const VarExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VarExpectationNode *>(this)); auto it = temporary_terms.find(const_cast<VarExpectationNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
} }
@ -8019,11 +8019,11 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
<< datatree.symbol_table.getTypeSpecificID(growth_param_index) + 1 << ";" << endl; << datatree.symbol_table.getTypeSpecificID(growth_param_index) + 1 << ";" << endl;
output << "M_.pac." << model_name << ".ec.params = "; output << "M_.pac." << model_name << ".ec.params = ";
set<pair<int, pair<int, int> > >::const_iterator it = ec_params_and_vars.begin(); auto it = ec_params_and_vars.begin();
output << datatree.symbol_table.getTypeSpecificID(it->first) + 1 output << datatree.symbol_table.getTypeSpecificID(it->first) + 1
<< ";" << endl << ";" << endl
<< "M_.pac." << model_name << ".ec.vars = ["; << "M_.pac." << model_name << ".ec.vars = [";
for (set<pair<int, pair<int, int> > >::const_iterator it = ec_params_and_vars.begin(); for (auto it = ec_params_and_vars.begin();
it != ec_params_and_vars.end(); it++) it != ec_params_and_vars.end(); it++)
{ {
if (it != ec_params_and_vars.begin()) if (it != ec_params_and_vars.begin())
@ -8032,7 +8032,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << model_name << ".ar.params = ["; << "M_.pac." << model_name << ".ar.params = [";
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin(); for (auto it = ar_params_and_vars.begin();
it != ar_params_and_vars.end(); it++) it != ar_params_and_vars.end(); it++)
{ {
if (it != ar_params_and_vars.begin()) if (it != ar_params_and_vars.begin())
@ -8041,7 +8041,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << model_name << ".ar.vars = ["; << "M_.pac." << model_name << ".ar.vars = [";
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin(); for (auto it = ar_params_and_vars.begin();
it != ar_params_and_vars.end(); it++) it != ar_params_and_vars.end(); it++)
{ {
if (it != ar_params_and_vars.begin()) if (it != ar_params_and_vars.begin())
@ -8050,7 +8050,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << model_name << ".ar.lags = ["; << "M_.pac." << model_name << ".ar.lags = [";
for (set<pair<int, pair<int, int> > >::const_iterator it = ar_params_and_vars.begin(); for (auto it = ar_params_and_vars.begin();
it != ar_params_and_vars.end(); it++) it != ar_params_and_vars.end(); it++)
{ {
if (it != ar_params_and_vars.begin()) if (it != ar_params_and_vars.begin())
@ -8059,7 +8059,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << model_name << ".h0_param_indices = ["; << "M_.pac." << model_name << ".h0_param_indices = [";
for (vector<int>::const_iterator it = h0_indices.begin(); for (auto it = h0_indices.begin();
it != h0_indices.end(); it++) it != h0_indices.end(); it++)
{ {
if (it != h0_indices.begin()) if (it != h0_indices.begin())
@ -8068,7 +8068,7 @@ PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
} }
output << "];" << endl output << "];" << endl
<< "M_.pac." << model_name << ".h1_param_indices = ["; << "M_.pac." << model_name << ".h1_param_indices = [";
for (vector<int>::const_iterator it = h1_indices.begin(); for (auto it = h1_indices.begin();
it != h1_indices.end(); it++) it != h1_indices.end(); it++)
{ {
if (it != h1_indices.begin()) if (it != h1_indices.begin())
@ -8196,7 +8196,7 @@ PacExpectationNode::collectDynamicVariables(SymbolType type_arg, set<pair<int, i
void void
PacExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const PacExpectationNode::collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const
{ {
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<PacExpectationNode *>(this)); auto it = temporary_terms.find(const_cast<PacExpectationNode *>(this));
if (it != temporary_terms.end()) if (it != temporary_terms.end())
temporary_terms_inuse.insert(idx); temporary_terms_inuse.insert(idx);
} }

View File

@ -81,7 +81,7 @@ public:
inline bool inline bool
ExternalFunctionsTable::exists(int symb_id) const ExternalFunctionsTable::exists(int symb_id) const
{ {
external_function_table_type::const_iterator iter = externalFunctionTable.find(symb_id); auto iter = externalFunctionTable.find(symb_id);
return (iter != externalFunctionTable.end()); return (iter != externalFunctionTable.end());
} }

View File

@ -61,15 +61,15 @@ ModFile::evalAllExpressions(bool warn_uninit, const bool nopreprocessoroutput)
// Loop over all statements, and fill global eval context if relevant // Loop over all statements, and fill global eval context if relevant
for (vector<Statement *>::const_iterator it = statements.begin(); it != statements.end(); it++) for (vector<Statement *>::const_iterator it = statements.begin(); it != statements.end(); it++)
{ {
InitParamStatement *ips = dynamic_cast<InitParamStatement *>(*it); auto *ips = dynamic_cast<InitParamStatement *>(*it);
if (ips) if (ips)
ips->fillEvalContext(global_eval_context); ips->fillEvalContext(global_eval_context);
InitOrEndValStatement *ies = dynamic_cast<InitOrEndValStatement *>(*it); auto *ies = dynamic_cast<InitOrEndValStatement *>(*it);
if (ies) if (ies)
ies->fillEvalContext(global_eval_context); ies->fillEvalContext(global_eval_context);
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it); auto *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(*it);
if (lpass) if (lpass)
lpass->fillEvalContext(global_eval_context); lpass->fillEvalContext(global_eval_context);
} }
@ -310,7 +310,7 @@ ModFile::checkPass(bool nostrict, bool stochastic)
if (parameters_intersect.size() > 0) if (parameters_intersect.size() > 0)
{ {
cerr << "ERROR: some estimated parameters ("; cerr << "ERROR: some estimated parameters (";
for (set<int>::const_iterator it = parameters_intersect.begin(); for (auto it = parameters_intersect.begin();
it != parameters_intersect.end();) it != parameters_intersect.end();)
{ {
cerr << symbol_table.getName(*it); cerr << symbol_table.getName(*it);
@ -381,7 +381,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
for (vector<Statement *>::const_iterator it = statements.begin(); for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++) it != statements.end(); it++)
{ {
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(*it); auto *vms = dynamic_cast<VarModelStatement *>(*it);
if (vms != NULL) if (vms != NULL)
{ {
string var_model_name; string var_model_name;
@ -403,7 +403,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
make_pair(diff, orig_diff_var)), make_pair(diff, orig_diff_var)),
make_pair(make_pair(max_lag, nonstationary), eqnumber)); make_pair(make_pair(max_lag, nonstationary), eqnumber));
} }
PacModelStatement *pms = dynamic_cast<PacModelStatement *>(*it); auto *pms = dynamic_cast<PacModelStatement *>(*it);
if (pms != NULL) if (pms != NULL)
{ {
pair<string, pair<string, pair<string, pair<int, map<string, int> > > > > pair<string, pair<string, pair<string, pair<int, map<string, int> > > > >
@ -462,7 +462,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
StaticModel *planner_objective = NULL; StaticModel *planner_objective = NULL;
for (auto & statement : statements) for (auto & statement : statements)
{ {
PlannerObjectiveStatement *pos = dynamic_cast<PlannerObjectiveStatement *>(statement); auto *pos = dynamic_cast<PlannerObjectiveStatement *>(statement);
if (pos != NULL) if (pos != NULL)
planner_objective = pos->getPlannerObjective(); planner_objective = pos->getPlannerObjective();
} }
@ -523,7 +523,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
for (vector<Statement *>::const_iterator it = statements.begin(); for (vector<Statement *>::const_iterator it = statements.begin();
it != statements.end(); it++) it != statements.end(); it++)
{ {
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(*it); auto *vms = dynamic_cast<VarModelStatement *>(*it);
if (vms != NULL) if (vms != NULL)
{ {
string var_model_name; string var_model_name;
@ -597,7 +597,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
if (mod_file_struct.ramsey_policy_present) if (mod_file_struct.ramsey_policy_present)
for (auto & statement : statements) for (auto & statement : statements)
{ {
RamseyPolicyStatement *rps = dynamic_cast<RamseyPolicyStatement *>(statement); auto *rps = dynamic_cast<RamseyPolicyStatement *>(statement);
if (rps != NULL) if (rps != NULL)
rps->checkRamseyPolicyList(); rps->checkRamseyPolicyList();
} }
@ -988,7 +988,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
/* Special treatment for initval block: insert initial values for the /* Special treatment for initval block: insert initial values for the
auxiliary variables and initialize exo det */ auxiliary variables and initialize exo det */
InitValStatement *ivs = dynamic_cast<InitValStatement *>(statement); auto *ivs = dynamic_cast<InitValStatement *>(statement);
if (ivs != NULL) if (ivs != NULL)
{ {
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel); static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
@ -996,17 +996,17 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
} }
// Special treatment for endval block: insert initial values for the auxiliary variables // Special treatment for endval block: insert initial values for the auxiliary variables
EndValStatement *evs = dynamic_cast<EndValStatement *>(statement); auto *evs = dynamic_cast<EndValStatement *>(statement);
if (evs != NULL) if (evs != NULL)
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel); static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
// Special treatment for load params and steady state statement: insert initial values for the auxiliary variables // Special treatment for load params and steady state statement: insert initial values for the auxiliary variables
LoadParamsAndSteadyStateStatement *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(statement); auto *lpass = dynamic_cast<LoadParamsAndSteadyStateStatement *>(statement);
if (lpass && !no_static) if (lpass && !no_static)
static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel); static_model.writeAuxVarInitval(mOutputFile, oMatlabOutsideModel);
// Special treatement for Var Models // Special treatement for Var Models
VarModelStatement *vms = dynamic_cast<VarModelStatement *>(statement); auto *vms = dynamic_cast<VarModelStatement *>(statement);
if (vms != NULL) if (vms != NULL)
vms->createVarModelMFunction(mOutputFile, dynamic_model.getVarExpectationFunctionsToWrite()); vms->createVarModelMFunction(mOutputFile, dynamic_model.getVarExpectationFunctionsToWrite());
} }
@ -1489,7 +1489,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
if (!statements.empty()) if (!statements.empty())
{ {
output << ", \"statements\": ["; output << ", \"statements\": [";
for (vector<Statement *>::const_iterator it = statements.begin(); for (auto it = statements.begin();
it != statements.end(); it++) it != statements.end(); it++)
{ {
if (it != statements.begin()) if (it != statements.begin())

View File

@ -234,7 +234,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
{ {
for (size_t i = 0; i < equations.size(); i++) for (size_t i = 0; i < equations.size(); i++)
{ {
VariableNode *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1()); auto *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
if (lhs == NULL) if (lhs == NULL)
continue; continue;
@ -450,13 +450,13 @@ ModelTree::equationTypeDetermination(const map<pair<int, pair<int, int> >, expr_
eq_node = equations[eq]; eq_node = equations[eq];
lhs = eq_node->get_arg1(); lhs = eq_node->get_arg1();
Equation_Simulation_Type = E_SOLVE; Equation_Simulation_Type = E_SOLVE;
map<pair<int, pair<int, int> >, expr_t>::const_iterator derivative = first_order_endo_derivatives.find(make_pair(eq, make_pair(var, 0))); auto derivative = first_order_endo_derivatives.find(make_pair(eq, make_pair(var, 0)));
pair<bool, expr_t> res; pair<bool, expr_t> res;
if (derivative != first_order_endo_derivatives.end()) if (derivative != first_order_endo_derivatives.end())
{ {
set<pair<int, int> > result; set<pair<int, int> > result;
derivative->second->collectEndogenous(result); derivative->second->collectEndogenous(result);
set<pair<int, int> >::const_iterator d_endo_variable = result.find(make_pair(var, 0)); auto d_endo_variable = result.find(make_pair(var, 0));
//Determine whether the equation could be evaluated rather than to be solved //Determine whether the equation could be evaluated rather than to be solved
if (lhs->isVariableNodeEqualTo(eEndogenous, Index_Var_IM[i], 0) && derivative->second->isNumConstNodeEqualTo(1)) if (lhs->isVariableNodeEqualTo(eEndogenous, Index_Var_IM[i], 0) && derivative->second->isNumConstNodeEqualTo(1))
{ {
@ -836,7 +836,7 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
{ {
int curr_variable = it.first; int curr_variable = it.first;
int curr_lag = it.second; int curr_lag = it.second;
vector<int>::const_iterator it1 = find(variable_reordered.begin()+first_count_equ, variable_reordered.begin()+(first_count_equ+Blck_Size), curr_variable); auto it1 = find(variable_reordered.begin()+first_count_equ, variable_reordered.begin()+(first_count_equ+Blck_Size), curr_variable);
if (it1 != variable_reordered.begin()+(first_count_equ+Blck_Size)) if (it1 != variable_reordered.begin()+(first_count_equ+Blck_Size))
if (dynamic_jacobian.find(make_pair(curr_lag, make_pair(equation_reordered[count_equ], curr_variable))) != dynamic_jacobian.end()) if (dynamic_jacobian.find(make_pair(curr_lag, make_pair(equation_reordered[count_equ], curr_variable))) != dynamic_jacobian.end())
{ {
@ -891,7 +891,7 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
{ {
for (int j = first_equation; j < first_equation+c_Size; j++) for (int j = first_equation; j < first_equation+c_Size; j++)
{ {
dynamic_jacob_map_t::const_iterator it = dynamic_jacobian.find(make_pair(-1, make_pair(equation_reordered[eq], variable_reordered[j]))); auto it = dynamic_jacobian.find(make_pair(-1, make_pair(equation_reordered[eq], variable_reordered[j])));
if (it != dynamic_jacobian.end()) if (it != dynamic_jacobian.end())
is_lag = true; is_lag = true;
it = dynamic_jacobian.find(make_pair(+1, make_pair(equation_reordered[eq], variable_reordered[j]))); it = dynamic_jacobian.find(make_pair(+1, make_pair(equation_reordered[eq], variable_reordered[j])));
@ -1025,7 +1025,7 @@ ModelTree::writeDerivative(ostream &output, int eq, int symb_id, int lag,
ExprNodeOutputType output_type, ExprNodeOutputType output_type,
const temporary_terms_t &temporary_terms) const const temporary_terms_t &temporary_terms) const
{ {
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symb_id, lag))); auto it = first_derivatives.find(make_pair(eq, getDerivID(symb_id, lag)));
if (it != first_derivatives.end()) if (it != first_derivatives.end())
(it->second)->writeOutput(output, output_type, temporary_terms, {}); (it->second)->writeOutput(output, output_type, temporary_terms, {});
else else
@ -1221,7 +1221,7 @@ ModelTree::writeTemporaryTerms(const temporary_terms_t &tt,
{ {
// Local var used to keep track of temp nodes already written // Local var used to keep track of temp nodes already written
temporary_terms_t tt2 = ttm1; temporary_terms_t tt2 = ttm1;
for (temporary_terms_t::const_iterator it = tt.begin(); for (auto it = tt.begin();
it != tt.end(); it++) it != tt.end(); it++)
{ {
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL) if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
@ -1278,7 +1278,7 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_
wrote_term = false; wrote_term = false;
output << "]" output << "]"
<< ", \"temporary_terms_" << concat << "\": ["; << ", \"temporary_terms_" << concat << "\": [";
for (temporary_terms_t::const_iterator it = tt.begin(); for (auto it = tt.begin();
it != tt.end(); it++) it != tt.end(); it++)
if (ttm1.find(*it) == ttm1.end()) if (ttm1.find(*it) == ttm1.end())
{ {
@ -1733,7 +1733,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
void void
ModelTree::addEquation(expr_t eq, int lineno) ModelTree::addEquation(expr_t eq, int lineno)
{ {
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq); auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual); assert(beq != NULL && beq->get_op_code() == oEqual);
equations.push_back(beq); equations.push_back(beq);
@ -1752,7 +1752,7 @@ ModelTree::addEquation(expr_t eq, int lineno, const vector<pair<string, string>
void void
ModelTree::addAuxEquation(expr_t eq) ModelTree::addAuxEquation(expr_t eq)
{ {
BinaryOpNode *beq = dynamic_cast<BinaryOpNode *>(eq); auto *beq = dynamic_cast<BinaryOpNode *>(eq);
assert(beq != NULL && beq->get_op_code() == oEqual); assert(beq != NULL && beq->get_op_code() == oEqual);
aux_equations.push_back(beq); aux_equations.push_back(beq);

View File

@ -33,7 +33,7 @@ NumericalConstants::AddNonNegativeConstant(const string &iConst)
if (iter != numConstantsIndex.end()) if (iter != numConstantsIndex.end())
return iter->second; return iter->second;
int id = (int) mNumericalConstants.size(); auto id = (int) mNumericalConstants.size();
mNumericalConstants.push_back(iConst); mNumericalConstants.push_back(iConst);
numConstantsIndex[iConst] = id; numConstantsIndex[iConst] = id;

View File

@ -174,7 +174,7 @@ InitOrEndValStatement::writeInitValues(ostream &output) const
void void
InitOrEndValStatement::writeJsonInitValues(ostream &output) const InitOrEndValStatement::writeJsonInitValues(ostream &output) const
{ {
for (init_values_t::const_iterator it = init_values.begin(); for (auto it = init_values.begin();
it != init_values.end(); it++) it != init_values.end(); it++)
{ {
if (it != init_values.begin()) if (it != init_values.begin())
@ -414,7 +414,7 @@ void
HistValStatement::writeJsonOutput(ostream &output) const HistValStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"hist_val\", \"vals\": ["; output << "{\"statementName\": \"hist_val\", \"vals\": [";
for (hist_values_t::const_iterator it = hist_values.begin(); for (auto it = hist_values.begin();
it != hist_values.end(); it++) it != hist_values.end(); it++)
{ {
if (it != hist_values.begin()) if (it != hist_values.begin())
@ -510,7 +510,7 @@ HomotopyStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"homotopy\", " output << "{\"statementName\": \"homotopy\", "
<< "\"values\": ["; << "\"values\": [";
for (homotopy_values_t::const_iterator it = homotopy_values.begin(); for (auto it = homotopy_values.begin();
it != homotopy_values.end(); it++) it != homotopy_values.end(); it++)
{ {
if (it != homotopy_values.begin()) if (it != homotopy_values.begin())
@ -617,7 +617,7 @@ LoadParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"load_params_and_steady_state\"" output << "{\"statementName\": \"load_params_and_steady_state\""
<< "\"values\": ["; << "\"values\": [";
for (map<int, string>::const_iterator it = content.begin(); for (auto it = content.begin();
it != content.end(); it++) it != content.end(); it++)
{ {
if (it != content.begin()) if (it != content.begin())

View File

@ -426,7 +426,7 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
mod_file->symbol_table.changeType(symb_id, new_type); mod_file->symbol_table.changeType(symb_id, new_type);
// change in equations in ModelTree // change in equations in ModelTree
DynamicModel *dm = new DynamicModel(mod_file->symbol_table, auto *dm = new DynamicModel(mod_file->symbol_table,
mod_file->num_constants, mod_file->num_constants,
mod_file->external_functions_table); mod_file->external_functions_table);
mod_file->dynamic_model.updateAfterVariableChange(*dm); mod_file->dynamic_model.updateAfterVariableChange(*dm);
@ -434,7 +434,7 @@ ParsingDriver::declare_or_change_type(SymbolType new_type, string *name)
// remove error messages // remove error messages
undeclared_model_vars.erase(*name); undeclared_model_vars.erase(*name);
for (vector<pair<string, string> >::iterator it = undeclared_model_variable_errors.begin(); for (auto it = undeclared_model_variable_errors.begin();
it != undeclared_model_variable_errors.end();) it != undeclared_model_variable_errors.end();)
if (it->first == *name) if (it->first == *name)
it = undeclared_model_variable_errors.erase(it); it = undeclared_model_variable_errors.erase(it);
@ -593,7 +593,7 @@ void
ParsingDriver::add_VAR_exclusion_restriction(string *lagstr) ParsingDriver::add_VAR_exclusion_restriction(string *lagstr)
{ {
int lag = atoi(lagstr->c_str()); int lag = atoi(lagstr->c_str());
map<int, map<int, SymbolList> >::iterator it = exclusion_restrictions.find(lag); auto it = exclusion_restrictions.find(lag);
if (it == exclusion_restrictions.end()) if (it == exclusion_restrictions.end())
exclusion_restrictions[lag] = exclusion_restriction; exclusion_restrictions[lag] = exclusion_restriction;
else else
@ -1250,7 +1250,7 @@ ParsingDriver::combine_lag_and_restriction(string *lag)
for (map<int, vector<int> >::const_iterator it = svar_equation_restrictions.begin(); for (map<int, vector<int> >::const_iterator it = svar_equation_restrictions.begin();
it != svar_equation_restrictions.end(); it++) it != svar_equation_restrictions.end(); it++)
for (vector<int>::const_iterator it1 = it->second.begin(); for (auto it1 = it->second.begin();
it1 != it->second.end(); it1++) it1 != it->second.end(); it1++)
{ {
SvarIdentificationStatement::svar_identification_restriction new_restriction; SvarIdentificationStatement::svar_identification_restriction new_restriction;
@ -2869,7 +2869,7 @@ ParsingDriver::add_diff(expr_t arg1)
expr_t expr_t
ParsingDriver::add_adl(expr_t arg1, string *name, string *lag) ParsingDriver::add_adl(expr_t arg1, string *name, string *lag)
{ {
vector<int> *lags = new vector<int>(); auto *lags = new vector<int>();
for (int i = 1; i <= atoi(lag->c_str()); i++) for (int i = 1; i <= atoi(lag->c_str()); i++)
lags->push_back(i); lags->push_back(i);
@ -3126,8 +3126,8 @@ ParsingDriver::is_there_one_integer_argument() const
if (stack_external_function_args.top().size() != 1) if (stack_external_function_args.top().size() != 1)
return make_pair(false, 0); return make_pair(false, 0);
NumConstNode *numNode = dynamic_cast<NumConstNode *>(stack_external_function_args.top().front()); auto *numNode = dynamic_cast<NumConstNode *>(stack_external_function_args.top().front());
UnaryOpNode *unaryNode = dynamic_cast<UnaryOpNode *>(stack_external_function_args.top().front()); auto *unaryNode = dynamic_cast<UnaryOpNode *>(stack_external_function_args.top().front());
if (numNode == NULL && unaryNode == NULL) if (numNode == NULL && unaryNode == NULL)
return make_pair(false, 0); return make_pair(false, 0);

View File

@ -71,14 +71,14 @@ void
AbstractShocksStatement::writeJsonDetShocks(ostream &output) const AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
{ {
output << "\"deterministic_shocks\": ["; output << "\"deterministic_shocks\": [";
for (det_shocks_t::const_iterator it = det_shocks.begin(); for (auto it = det_shocks.begin();
it != det_shocks.end(); it++) it != det_shocks.end(); it++)
{ {
if (it != det_shocks.begin()) if (it != det_shocks.begin())
output << ", "; output << ", ";
output << "{\"var\": \"" << symbol_table.getName(it->first) << "\", " output << "{\"var\": \"" << symbol_table.getName(it->first) << "\", "
<< "\"values\": ["; << "\"values\": [";
for (vector<DetShockElement>::const_iterator it1 = it->second.begin(); for (auto it1 = it->second.begin();
it1 != it->second.end(); it1++) it1 != it->second.end(); it1++)
{ {
if (it1 != it->second.begin()) if (it1 != it->second.begin())
@ -165,7 +165,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
writeJsonDetShocks(output); writeJsonDetShocks(output);
} }
output<< ", \"variance\": ["; output<< ", \"variance\": [";
for (var_and_std_shocks_t::const_iterator it = var_shocks.begin(); it != var_shocks.end(); it++) for (auto it = var_shocks.begin(); it != var_shocks.end(); it++)
{ {
if (it != var_shocks.begin()) if (it != var_shocks.begin())
output << ", "; output << ", ";
@ -176,7 +176,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
} }
output << "]" output << "]"
<< ", \"stderr\": ["; << ", \"stderr\": [";
for (var_and_std_shocks_t::const_iterator it = std_shocks.begin(); it != std_shocks.end(); it++) for (auto it = std_shocks.begin(); it != std_shocks.end(); it++)
{ {
if (it != std_shocks.begin()) if (it != std_shocks.begin())
output << ", "; output << ", ";
@ -187,7 +187,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
} }
output << "]" output << "]"
<< ", \"covariance\": ["; << ", \"covariance\": [";
for (covar_and_corr_shocks_t::const_iterator it = covar_shocks.begin(); it != covar_shocks.end(); it++) for (auto it = covar_shocks.begin(); it != covar_shocks.end(); it++)
{ {
if (it != covar_shocks.begin()) if (it != covar_shocks.begin())
output << ", "; output << ", ";
@ -200,7 +200,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
} }
output << "]" output << "]"
<< ", \"correlation\": ["; << ", \"correlation\": [";
for (covar_and_corr_shocks_t::const_iterator it = corr_shocks.begin(); it != corr_shocks.end(); it++) for (auto it = corr_shocks.begin(); it != corr_shocks.end(); it++)
{ {
if (it != corr_shocks.begin()) if (it != corr_shocks.begin())
output << ", "; output << ", ";
@ -468,7 +468,7 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
<< "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl; << "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
int k = 1; int k = 1;
for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin(); for (auto it = paths.begin();
it != paths.end(); it++, k++) it != paths.end(); it++, k++)
{ {
if (it == paths.begin()) if (it == paths.begin())
@ -513,7 +513,7 @@ MomentCalibration::writeJsonOutput(ostream &output) const
{ {
output << "{\"statementName\": \"moment_calibration\"" output << "{\"statementName\": \"moment_calibration\""
<< ", \"moment_calibration_criteria\": ["; << ", \"moment_calibration_criteria\": [";
for (constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); it++) for (auto it = constraints.begin(); it != constraints.end(); it++)
{ {
if (it != constraints.begin()) if (it != constraints.begin())
output << ", "; output << ", ";
@ -563,7 +563,7 @@ IrfCalibration::writeJsonOutput(ostream &output) const
} }
output << ", \"irf_restrictions\": ["; output << ", \"irf_restrictions\": [";
for (constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); it++) for (auto it = constraints.begin(); it != constraints.end(); it++)
{ {
if (it != constraints.begin()) if (it != constraints.begin())
output << ", "; output << ", ";
@ -588,9 +588,9 @@ ShockGroupsStatement::writeOutput(ostream &output, const string &basename, bool
{ {
int i = 1; int i = 1;
bool unique_label = true; bool unique_label = true;
for (vector<Group>::const_iterator it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label = true) for (auto it = shock_groups.begin(); it != shock_groups.end(); it++, unique_label = true)
{ {
for (vector<Group>::const_iterator it1 = it+1; it1 != shock_groups.end(); it1++) for (auto it1 = it+1; it1 != shock_groups.end(); it1++)
if (it->name == it1->name) if (it->name == it1->name)
{ {
unique_label = false; unique_label = false;

View File

@ -165,7 +165,7 @@ OptionsList::writeOutput(ostream &output) const
if (vector_int_option.second.size() > 1) if (vector_int_option.second.size() > 1)
{ {
output << "["; output << "[";
for (vector<int>::const_iterator viit = vector_int_option.second.begin(); for (auto viit = vector_int_option.second.begin();
viit != vector_int_option.second.end(); viit++) viit != vector_int_option.second.end(); viit++)
output << *viit << ";"; output << *viit << ";";
output << "];" << endl; output << "];" << endl;
@ -180,7 +180,7 @@ OptionsList::writeOutput(ostream &output) const
if (vector_str_option.second.size() > 1) if (vector_str_option.second.size() > 1)
{ {
output << "{"; output << "{";
for (vector<string>::const_iterator viit = vector_str_option.second.begin(); for (auto viit = vector_str_option.second.begin();
viit != vector_str_option.second.end(); viit++) viit != vector_str_option.second.end(); viit++)
output << "'" << *viit << "';"; output << "'" << *viit << "';";
output << "};" << endl; output << "};" << endl;
@ -226,7 +226,7 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
if (vector_int_option.second.size() > 1) if (vector_int_option.second.size() > 1)
{ {
output << "["; output << "[";
for (vector<int>::const_iterator viit = vector_int_option.second.begin(); for (auto viit = vector_int_option.second.begin();
viit != vector_int_option.second.end(); viit++) viit != vector_int_option.second.end(); viit++)
output << *viit << ";"; output << *viit << ";";
output << "];" << endl; output << "];" << endl;
@ -241,7 +241,7 @@ OptionsList::writeOutput(ostream &output, const string &option_group) const
if (vector_str_option.second.size() > 1) if (vector_str_option.second.size() > 1)
{ {
output << "{"; output << "{";
for (vector<string>::const_iterator viit = vector_str_option.second.begin(); for (auto viit = vector_str_option.second.begin();
viit != vector_str_option.second.end(); viit++) viit != vector_str_option.second.end(); viit++)
output << "'" << *viit << "';"; output << "'" << *viit << "';";
output << "};" << endl; output << "};" << endl;
@ -258,7 +258,7 @@ OptionsList::writeJsonOutput(ostream &output) const
return; return;
output << "\"options\": {"; output << "\"options\": {";
for (num_options_t::const_iterator it = num_options.begin(); for (auto it = num_options.begin();
it != num_options.end();) it != num_options.end();)
{ {
output << "\""<< it->first << "\": " << it->second; output << "\""<< it->first << "\": " << it->second;
@ -272,7 +272,7 @@ OptionsList::writeJsonOutput(ostream &output) const
output << ", "; output << ", ";
} }
for (paired_num_options_t::const_iterator it = paired_num_options.begin(); for (auto it = paired_num_options.begin();
it != paired_num_options.end();) it != paired_num_options.end();)
{ {
output << "\""<< it->first << "\": [" << it->second.first << " " << it->second.second << "]"; output << "\""<< it->first << "\": [" << it->second.first << " " << it->second.second << "]";
@ -285,7 +285,7 @@ OptionsList::writeJsonOutput(ostream &output) const
output << ", "; output << ", ";
} }
for (string_options_t::const_iterator it = string_options.begin(); for (auto it = string_options.begin();
it != string_options.end();) it != string_options.end();)
{ {
output << "\""<< it->first << "\": \"" << it->second << "\""; output << "\""<< it->first << "\": \"" << it->second << "\"";
@ -297,7 +297,7 @@ OptionsList::writeJsonOutput(ostream &output) const
output << ", "; output << ", ";
} }
for (date_options_t::const_iterator it = date_options.begin(); for (auto it = date_options.begin();
it != date_options.end();) it != date_options.end();)
{ {
output << "\""<< it->first << "\": \"" << it->second << "\""; output << "\""<< it->first << "\": \"" << it->second << "\"";
@ -308,7 +308,7 @@ OptionsList::writeJsonOutput(ostream &output) const
output << ", "; output << ", ";
} }
for (symbol_list_options_t::const_iterator it = symbol_list_options.begin(); for (auto it = symbol_list_options.begin();
it != symbol_list_options.end(); it++) it != symbol_list_options.end(); it++)
{ {
output << "\""<< it->first << "\":"; output << "\""<< it->first << "\":";
@ -319,13 +319,13 @@ OptionsList::writeJsonOutput(ostream &output) const
output << ", "; output << ", ";
} }
for (vec_int_options_t::const_iterator it = vector_int_options.begin(); for (auto it = vector_int_options.begin();
it != vector_int_options.end();) it != vector_int_options.end();)
{ {
output << "\""<< it->first << "\": ["; output << "\""<< it->first << "\": [";
if (it->second.size() > 1) if (it->second.size() > 1)
{ {
for (vector<int>::const_iterator viit = it->second.begin(); for (auto viit = it->second.begin();
viit != it->second.end();) viit != it->second.end();)
{ {
output << *viit; output << *viit;
@ -343,13 +343,13 @@ OptionsList::writeJsonOutput(ostream &output) const
} }
for (vec_str_options_t::const_iterator it = vector_str_options.begin(); for (auto it = vector_str_options.begin();
it != vector_str_options.end();) it != vector_str_options.end();)
{ {
output << "\""<< it->first << "\": ["; output << "\""<< it->first << "\": [";
if (it->second.size() > 1) if (it->second.size() > 1)
{ {
for (vector<string>::const_iterator viit = it->second.begin(); for (auto viit = it->second.begin();
viit != it->second.end();) viit != it->second.end();)
{ {
output << "\"" << *viit << "\""; output << "\"" << *viit << "\"";

View File

@ -46,7 +46,7 @@ StaticModel::StaticModel(SymbolTable &symbol_table_arg,
void void
StaticModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, map_idx_t &map_idx, temporary_terms_t temporary_terms) const StaticModel::compileDerivative(ofstream &code_file, unsigned int &instruction_number, int eq, int symb_id, map_idx_t &map_idx, temporary_terms_t temporary_terms) const
{ {
first_derivatives_t::const_iterator it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), 0))); auto it = first_derivatives.find(make_pair(eq, getDerivID(symbol_table.getID(eEndogenous, symb_id), 0)));
if (it != first_derivatives.end()) if (it != first_derivatives.end())
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false); (it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
else else
@ -59,7 +59,7 @@ StaticModel::compileDerivative(ofstream &code_file, unsigned int &instruction_nu
void void
StaticModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, map_idx_t &map_idx, temporary_terms_t temporary_terms) const StaticModel::compileChainRuleDerivative(ofstream &code_file, unsigned int &instruction_number, int eqr, int varr, int lag, map_idx_t &map_idx, temporary_terms_t temporary_terms) const
{ {
map<pair<int, pair<int, int> >, expr_t>::const_iterator it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag))); auto it = first_chain_rule_derivatives.find(make_pair(eqr, make_pair(varr, lag)));
if (it != first_chain_rule_derivatives.end()) if (it != first_chain_rule_derivatives.end())
(it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false); (it->second)->compile(code_file, instruction_number, false, temporary_terms, map_idx, false, false);
else else
@ -175,7 +175,7 @@ StaticModel::computeTemporaryTermsOrdered()
id->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); id->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
} }
for (int i = 0; i < (int) getBlockSize(block); i++) for (int i = 0; i < (int) getBlockSize(block); i++)
for (temporary_terms_t::const_iterator it = v_temporary_terms[block][i].begin(); for (auto it = v_temporary_terms[block][i].begin();
it != v_temporary_terms[block][i].end(); it++) it != v_temporary_terms[block][i].end(); it++)
(*it)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); (*it)->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block);
v_temporary_terms_inuse[block] = temporary_terms_in_use; v_temporary_terms_inuse[block] = temporary_terms_in_use;
@ -373,7 +373,7 @@ StaticModel::writeModelEquationsOrdered_M(const string &static_basename) const
case SOLVE_FORWARD_SIMPLE: case SOLVE_FORWARD_SIMPLE:
case SOLVE_BACKWARD_COMPLETE: case SOLVE_BACKWARD_COMPLETE:
case SOLVE_FORWARD_COMPLETE: case SOLVE_FORWARD_COMPLETE:
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -746,7 +746,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
case SOLVE_BACKWARD_COMPLETE: case SOLVE_BACKWARD_COMPLETE:
case SOLVE_FORWARD_COMPLETE: case SOLVE_FORWARD_COMPLETE:
count_u = feedback_variables.size(); count_u = feedback_variables.size();
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -842,7 +842,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
{ {
if (v_temporary_terms_local[block].size()) if (v_temporary_terms_local[block].size())
{ {
for (temporary_terms_t::const_iterator it = v_temporary_terms_local[block][i].begin(); for (auto it = v_temporary_terms_local[block][i].begin();
it != v_temporary_terms_local[block][i].end(); it++) it != v_temporary_terms_local[block][i].end(); it++)
{ {
if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL) if (dynamic_cast<AbstractExternalFunctionNode *>(*it) != NULL)
@ -940,7 +940,7 @@ StaticModel::writeModelEquationsCode_Block(const string file_name, const string
case SOLVE_BACKWARD_COMPLETE: case SOLVE_BACKWARD_COMPLETE:
case SOLVE_FORWARD_COMPLETE: case SOLVE_FORWARD_COMPLETE:
count_u = feedback_variables.size(); count_u = feedback_variables.size();
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++) for (auto it = blocks_derivatives[block].begin(); it != (blocks_derivatives[block]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -991,7 +991,7 @@ StaticModel::Write_Inf_To_Bin_File_Block(const string &static_basename, const st
unsigned int block_size = getBlockSize(num); unsigned int block_size = getBlockSize(num);
unsigned int block_mfs = getBlockMfs(num); unsigned int block_mfs = getBlockMfs(num);
unsigned int block_recursive = block_size - block_mfs; unsigned int block_recursive = block_size - block_mfs;
for (block_derivatives_equation_variable_laglead_nodeid_t::const_iterator it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++) for (auto it = blocks_derivatives[num].begin(); it != (blocks_derivatives[num]).end(); it++)
{ {
unsigned int eq = it->first.first; unsigned int eq = it->first.first;
unsigned int var = it->first.second; unsigned int var = it->first.second;
@ -2538,7 +2538,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
} }
int i = 1; int i = 1;
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin(); for (auto it = residuals_params_second_derivatives.begin();
it != residuals_params_second_derivatives.end(); ++it, i++) it != residuals_params_second_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -2562,7 +2562,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
} }
i = 1; i = 1;
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin(); for (auto it = jacobian_params_second_derivatives.begin();
it != jacobian_params_second_derivatives.end(); ++it, i++) it != jacobian_params_second_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -2590,7 +2590,7 @@ StaticModel::writeParamsDerivativesFile(const string &basename, bool julia) cons
} }
i = 1; i = 1;
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin(); for (auto it = hessian_params_derivatives.begin();
it != hessian_params_derivatives.end(); ++it, i++) it != hessian_params_derivatives.end(); ++it, i++)
{ {
int eq = it->first.first; int eq = it->first.first;
@ -2761,7 +2761,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
<< " \"nrows\": " << nrows << " \"nrows\": " << nrows
<< ", \"ncols\": " << JacobianColsNbr << ", \"ncols\": " << JacobianColsNbr
<< ", \"entries\": ["; << ", \"entries\": [";
for (first_derivatives_t::const_iterator it = first_derivatives.begin(); for (auto it = first_derivatives.begin();
it != first_derivatives.end(); it++) it != first_derivatives.end(); it++)
{ {
if (it != first_derivatives.begin()) if (it != first_derivatives.begin())
@ -2799,7 +2799,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
<< " \"nrows\": " << equations.size() << " \"nrows\": " << equations.size()
<< ", \"ncols\": " << g2ncols << ", \"ncols\": " << g2ncols
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = second_derivatives.begin(); for (auto it = second_derivatives.begin();
it != second_derivatives.end(); it++) it != second_derivatives.end(); it++)
{ {
if (it != second_derivatives.begin()) if (it != second_derivatives.begin())
@ -2845,7 +2845,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
<< " \"nrows\": " << equations.size() << " \"nrows\": " << equations.size()
<< ", \"ncols\": " << hessianColsNbr * JacobianColsNbr << ", \"ncols\": " << hessianColsNbr * JacobianColsNbr
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = third_derivatives.begin(); for (auto it = third_derivatives.begin();
it != third_derivatives.end(); it++) it != third_derivatives.end(); it++)
{ {
if (it != third_derivatives.begin()) if (it != third_derivatives.begin())
@ -2874,7 +2874,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
cols.insert(id3 * hessianColsNbr + id2 * JacobianColsNbr + id1); cols.insert(id3 * hessianColsNbr + id2 * JacobianColsNbr + id1);
third_derivatives_output << ", \"col\": ["; third_derivatives_output << ", \"col\": [";
for (set<int>::iterator it2 = cols.begin(); it2 != cols.end(); it2++) for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
{ {
if (it2 != cols.begin()) if (it2 != cols.begin())
third_derivatives_output << ", "; third_derivatives_output << ", ";
@ -2933,7 +2933,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< " \"neqs\": " << equations.size() << " \"neqs\": " << equations.size()
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (first_derivatives_t::const_iterator it = residuals_params_derivatives.begin(); for (auto it = residuals_params_derivatives.begin();
it != residuals_params_derivatives.end(); it++) it != residuals_params_derivatives.end(); it++)
{ {
if (it != residuals_params_derivatives.begin()) if (it != residuals_params_derivatives.begin())
@ -2965,7 +2965,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nvarcols\": " << symbol_table.endo_nbr() << ", \"nvarcols\": " << symbol_table.endo_nbr()
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = jacobian_params_derivatives.begin(); for (auto it = jacobian_params_derivatives.begin();
it != jacobian_params_derivatives.end(); it++) it != jacobian_params_derivatives.end(); it++)
{ {
if (it != jacobian_params_derivatives.begin()) if (it != jacobian_params_derivatives.begin())
@ -3001,7 +3001,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nparam1cols\": " << symbol_table.param_nbr() << ", \"nparam1cols\": " << symbol_table.param_nbr()
<< ", \"nparam2cols\": " << symbol_table.param_nbr() << ", \"nparam2cols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (second_derivatives_t::const_iterator it = residuals_params_second_derivatives.begin(); for (auto it = residuals_params_second_derivatives.begin();
it != residuals_params_second_derivatives.end(); ++it) it != residuals_params_second_derivatives.end(); ++it)
{ {
if (it != residuals_params_second_derivatives.begin()) if (it != residuals_params_second_derivatives.begin())
@ -3038,7 +3038,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nparam1cols\": " << symbol_table.param_nbr() << ", \"nparam1cols\": " << symbol_table.param_nbr()
<< ", \"nparam2cols\": " << symbol_table.param_nbr() << ", \"nparam2cols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = jacobian_params_second_derivatives.begin(); for (auto it = jacobian_params_second_derivatives.begin();
it != jacobian_params_second_derivatives.end(); ++it) it != jacobian_params_second_derivatives.end(); ++it)
{ {
if (it != jacobian_params_second_derivatives.begin()) if (it != jacobian_params_second_derivatives.begin())
@ -3079,7 +3079,7 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
<< ", \"nvar2cols\": " << symbol_table.endo_nbr() << ", \"nvar2cols\": " << symbol_table.endo_nbr()
<< ", \"nparamcols\": " << symbol_table.param_nbr() << ", \"nparamcols\": " << symbol_table.param_nbr()
<< ", \"entries\": ["; << ", \"entries\": [";
for (third_derivatives_t::const_iterator it = hessian_params_derivatives.begin(); for (auto it = hessian_params_derivatives.begin();
it != hessian_params_derivatives.end(); ++it) it != hessian_params_derivatives.end(); ++it)
{ {
if (it != hessian_params_derivatives.begin()) if (it != hessian_params_derivatives.begin())

View File

@ -134,7 +134,7 @@ SteadyStateModel::writeLatexSteadyStateFile(const string &basename) const
<< "\\footnotesize" << endl; << "\\footnotesize" << endl;
for (const auto & it : def_table) for (const auto & it : def_table)
for (vector<int>::const_iterator it1 = it.first.begin(); it1 != it.first.end(); it1++) for (auto it1 = it.first.begin(); it1 != it.first.end(); it1++)
{ {
int id = *it1; int id = *it1;
expr_t value = it.second; expr_t value = it.second;
@ -193,7 +193,7 @@ SteadyStateModel::writeSteadyStateFile(const string &basename, bool ramsey_model
output << "["; output << "[";
for (size_t j = 0; j < symb_ids.size(); j++) for (size_t j = 0; j < symb_ids.size(); j++)
{ {
variable_node_map_t::const_iterator it = variable_node_map.find(make_pair(symb_ids[j], 0)); auto it = variable_node_map.find(make_pair(symb_ids[j], 0));
assert(it != variable_node_map.end()); assert(it != variable_node_map.end());
dynamic_cast<ExprNode *>(it->second)->writeOutput(output, output_type); dynamic_cast<ExprNode *>(it->second)->writeOutput(output, output_type);
if (j < symb_ids.size()-1) if (j < symb_ids.size()-1)
@ -254,7 +254,7 @@ SteadyStateModel::writeSteadyStateFileC(const string &basename, bool ramsey_mode
output << " "; output << " ";
if (symb_ids.size() > 1) if (symb_ids.size() > 1)
std::cout << "Error: in C, multiple returns are not permitted in steady_state_model" << std::endl; std::cout << "Error: in C, multiple returns are not permitted in steady_state_model" << std::endl;
variable_node_map_t::const_iterator it = variable_node_map.find(make_pair(symb_ids[0], 0)); auto it = variable_node_map.find(make_pair(symb_ids[0], 0));
assert(it != variable_node_map.end()); assert(it != variable_node_map.end());
if (it->second->get_type() == eModFileLocalVariable) if (it->second->get_type() == eModFileLocalVariable)
output << "double "; output << "double ";
@ -290,7 +290,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
{ {
if (j != 0) if (j != 0)
output << ","; output << ",";
variable_node_map_t::const_iterator it = auto it =
variable_node_map.find(make_pair(symb_ids[j], 0)); variable_node_map.find(make_pair(symb_ids[j], 0));
assert(it != variable_node_map.end()); assert(it != variable_node_map.end());
output << "\""; output << "\"";

View File

@ -29,7 +29,7 @@ void
SymbolList::writeOutput(const string &varname, ostream &output) const SymbolList::writeOutput(const string &varname, ostream &output) const
{ {
output << varname << " = {"; output << varname << " = {";
for (vector<string>::const_iterator it = symbols.begin(); for (auto it = symbols.begin();
it != symbols.end(); ++it) it != symbols.end(); ++it)
{ {
if (it != symbols.begin()) if (it != symbols.begin())
@ -43,7 +43,7 @@ void
SymbolList::writeJsonOutput(ostream &output) const SymbolList::writeJsonOutput(ostream &output) const
{ {
output << "\"symbol_list\": ["; output << "\"symbol_list\": [";
for (vector<string>::const_iterator it = symbols.begin(); for (auto it = symbols.begin();
it != symbols.end(); ++it) it != symbols.end(); ++it)
{ {
if (it != symbols.begin()) if (it != symbols.begin())

View File

@ -198,7 +198,7 @@ SymbolTable::getPartitionsForType(enum SymbolType st) const throw (UnknownSymbol
map<string, map<int, string> > partitions; map<string, map<int, string> > partitions;
for (const auto & it : partition_value_map) for (const auto & it : partition_value_map)
if (getType(it.first) == st) if (getType(it.first) == st)
for (map<string, string>::const_iterator it1 = it.second.begin(); for (auto it1 = it.second.begin();
it1 != it.second.end(); it1++) it1 != it.second.end(); it1++)
{ {
if (partitions.find(it1->first) == partitions.end()) if (partitions.find(it1->first) == partitions.end())
@ -393,7 +393,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
{ {
int ic = 1; int ic = 1;
output << "options_.varobs = cell(" << observedVariablesNbr() << ", 1);" << endl; output << "options_.varobs = cell(" << observedVariablesNbr() << ", 1);" << endl;
for (vector<int>::const_iterator it = varobs.begin(); for (auto it = varobs.begin();
it != varobs.end(); it++, ic++) it != varobs.end(); it++, ic++)
output << "options_.varobs(" << ic << ") = {'" << getName(*it) << "'};" << endl; output << "options_.varobs(" << ic << ") = {'" << getName(*it) << "'};" << endl;
@ -407,7 +407,7 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
{ {
int ic = 1; int ic = 1;
output << "options_.varexobs = cell(1);" << endl; output << "options_.varexobs = cell(1);" << endl;
for (vector<int>::const_iterator it = varexobs.begin(); for (auto it = varexobs.begin();
it != varexobs.end(); it++, ic++) it != varexobs.end(); it++, ic++)
output << "options_.varexobs(" << ic << ") = {'" << getName(*it) << "'};" << endl; output << "options_.varexobs(" << ic << ") = {'" << getName(*it) << "'};" << endl;
@ -498,7 +498,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
if (predeterminedNbr() > 0) if (predeterminedNbr() > 0)
{ {
output << "int predetermined_variables[" << predeterminedNbr() << "] = {"; output << "int predetermined_variables[" << predeterminedNbr() << "] = {";
for (set<int>::const_iterator it = predetermined_variables.begin(); for (auto it = predetermined_variables.begin();
it != predetermined_variables.end(); it++) it != predetermined_variables.end(); it++)
{ {
if (it != predetermined_variables.begin()) if (it != predetermined_variables.begin())
@ -512,7 +512,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
if (observedVariablesNbr() > 0) if (observedVariablesNbr() > 0)
{ {
output << "int varobs[" << observedVariablesNbr() << "] = {"; output << "int varobs[" << observedVariablesNbr() << "] = {";
for (vector<int>::const_iterator it = varobs.begin(); for (auto it = varobs.begin();
it != varobs.end(); it++) it != varobs.end(); it++)
{ {
if (it != varobs.begin()) if (it != varobs.begin())
@ -526,7 +526,7 @@ SymbolTable::writeCOutput(ostream &output) const throw (NotYetFrozenException)
if (observedExogenousVariablesNbr() > 0) if (observedExogenousVariablesNbr() > 0)
{ {
output << "int varexobs[" << observedExogenousVariablesNbr() << "] = {"; output << "int varexobs[" << observedExogenousVariablesNbr() << "] = {";
for (vector<int>::const_iterator it = varexobs.begin(); for (auto it = varexobs.begin();
it != varexobs.end(); it++) it != varexobs.end(); it++)
{ {
if (it != varexobs.begin()) if (it != varexobs.begin())
@ -926,7 +926,7 @@ SymbolTable::isObservedVariable(int symb_id) const
int int
SymbolTable::getObservedVariableIndex(int symb_id) const SymbolTable::getObservedVariableIndex(int symb_id) const
{ {
vector<int>::const_iterator it = find(varobs.begin(), varobs.end(), symb_id); auto it = find(varobs.begin(), varobs.end(), symb_id);
assert(it != varobs.end()); assert(it != varobs.end());
return (int) (it - varobs.begin()); return (int) (it - varobs.begin());
} }
@ -954,7 +954,7 @@ SymbolTable::isObservedExogenousVariable(int symb_id) const
int int
SymbolTable::getObservedExogenousVariableIndex(int symb_id) const SymbolTable::getObservedExogenousVariableIndex(int symb_id) const
{ {
vector<int>::const_iterator it = find(varexobs.begin(), varexobs.end(), symb_id); auto it = find(varexobs.begin(), varexobs.end(), symb_id);
assert(it != varexobs.end()); assert(it != varexobs.end());
return (int) (it - varexobs.begin()); return (int) (it - varexobs.begin());
} }

View File

@ -404,7 +404,7 @@ SymbolTable::validateSymbID(int symb_id) const throw (UnknownSymbolIDException)
inline bool inline bool
SymbolTable::exists(const string &name) const SymbolTable::exists(const string &name) const
{ {
symbol_table_type::const_iterator iter = symbol_table.find(name); auto iter = symbol_table.find(name);
return (iter != symbol_table.end()); return (iter != symbol_table.end());
} }
@ -445,7 +445,7 @@ SymbolTable::getType(const string &name) const throw (UnknownSymbolNameException
inline int inline int
SymbolTable::getID(const string &name) const throw (UnknownSymbolNameException) SymbolTable::getID(const string &name) const throw (UnknownSymbolNameException)
{ {
symbol_table_type::const_iterator iter = symbol_table.find(name); auto iter = symbol_table.find(name);
if (iter != symbol_table.end()) if (iter != symbol_table.end())
return iter->second; return iter->second;
else else

View File

@ -98,7 +98,7 @@ MacroDriver::set_variable(const string &name, const MacroValue *value)
const MacroValue * const MacroValue *
MacroDriver::get_variable(const string &name) const throw (UnknownVariable) MacroDriver::get_variable(const string &name) const throw (UnknownVariable)
{ {
map<string, const MacroValue *>::const_iterator it = env.find(name); auto it = env.find(name);
if (it == env.end()) if (it == env.end())
throw UnknownVariable(name); throw UnknownVariable(name);
return it->second; return it->second;
@ -107,8 +107,8 @@ MacroDriver::get_variable(const string &name) const throw (UnknownVariable)
void void
MacroDriver::init_loop(const string &name, const MacroValue *value) throw (MacroValue::TypeError) MacroDriver::init_loop(const string &name, const MacroValue *value) throw (MacroValue::TypeError)
{ {
const ArrayMV<int> *mv1 = dynamic_cast<const ArrayMV<int> *>(value); const auto *mv1 = dynamic_cast<const ArrayMV<int> *>(value);
const ArrayMV<string> *mv2 = dynamic_cast<const ArrayMV<string> *>(value); const auto *mv2 = dynamic_cast<const ArrayMV<string> *>(value);
if (!mv1 && !mv2) if (!mv1 && !mv2)
throw MacroValue::TypeError("Argument of @#for loop must be an array expression"); throw MacroValue::TypeError("Argument of @#for loop must be an array expression");
loop_stack.push(make_pair(name, make_pair(value, 0))); loop_stack.push(make_pair(name, make_pair(value, 0)));
@ -124,7 +124,7 @@ MacroDriver::iter_loop()
const MacroValue *mv = loop_stack.top().second.first; const MacroValue *mv = loop_stack.top().second.first;
string name = loop_stack.top().first; string name = loop_stack.top().first;
const ArrayMV<int> *mv1 = dynamic_cast<const ArrayMV<int> *>(mv); const auto *mv1 = dynamic_cast<const ArrayMV<int> *>(mv);
if (mv1) if (mv1)
{ {
if (i >= (int) mv1->values.size()) if (i >= (int) mv1->values.size())
@ -140,7 +140,7 @@ MacroDriver::iter_loop()
} }
else else
{ {
const ArrayMV<string> *mv2 = dynamic_cast<const ArrayMV<string> *>(mv); const auto *mv2 = dynamic_cast<const ArrayMV<string> *>(mv);
if (i >= (int) mv2->values.size()) if (i >= (int) mv2->values.size())
{ {
loop_stack.pop(); loop_stack.pop();
@ -157,7 +157,7 @@ MacroDriver::iter_loop()
void void
MacroDriver::begin_if(const MacroValue *value) throw (MacroValue::TypeError) MacroDriver::begin_if(const MacroValue *value) throw (MacroValue::TypeError)
{ {
const IntMV *ival = dynamic_cast<const IntMV *>(value); const auto *ival = dynamic_cast<const IntMV *>(value);
if (!ival) if (!ival)
throw MacroValue::TypeError("Argument of @#if must be an integer"); throw MacroValue::TypeError("Argument of @#if must be an integer");
last_if = (bool) ival->value; last_if = (bool) ival->value;
@ -194,7 +194,7 @@ MacroDriver::begin_ifndef(const string &name)
void void
MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError) MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError)
{ {
const StringMV *sval = dynamic_cast<const StringMV *>(value); const auto *sval = dynamic_cast<const StringMV *>(value);
if (!sval) if (!sval)
throw MacroValue::TypeError("Argument of @#echo must be a string"); throw MacroValue::TypeError("Argument of @#echo must be a string");
@ -204,7 +204,7 @@ MacroDriver::echo(const Macro::parser::location_type &l, const MacroValue *value
void void
MacroDriver::error(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError) MacroDriver::error(const Macro::parser::location_type &l, const MacroValue *value) const throw (MacroValue::TypeError)
{ {
const StringMV *sval = dynamic_cast<const StringMV *>(value); const auto *sval = dynamic_cast<const StringMV *>(value);
if (!sval) if (!sval)
throw MacroValue::TypeError("Argument of @#error must be a string"); throw MacroValue::TypeError("Argument of @#error must be a string");

View File

@ -149,7 +149,7 @@ IntMV::~IntMV()
const MacroValue * const MacroValue *
IntMV::operator+(const MacroValue &mv) const throw (TypeError) IntMV::operator+(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of + operator"); throw TypeError("Type mismatch for operands of + operator");
return new IntMV(driver, value + mv2->value); return new IntMV(driver, value + mv2->value);
@ -164,7 +164,7 @@ IntMV::operator+() const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator-(const MacroValue &mv) const throw (TypeError) IntMV::operator-(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of - operator"); throw TypeError("Type mismatch for operands of - operator");
return new IntMV(driver, value - mv2->value); return new IntMV(driver, value - mv2->value);
@ -179,7 +179,7 @@ IntMV::operator-() const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator*(const MacroValue &mv) const throw (TypeError) IntMV::operator*(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of * operator"); throw TypeError("Type mismatch for operands of * operator");
return new IntMV(driver, value * mv2->value); return new IntMV(driver, value * mv2->value);
@ -188,7 +188,7 @@ IntMV::operator*(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator/(const MacroValue &mv) const throw (TypeError) IntMV::operator/(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of / operator"); throw TypeError("Type mismatch for operands of / operator");
return new IntMV(driver, value / mv2->value); return new IntMV(driver, value / mv2->value);
@ -197,7 +197,7 @@ IntMV::operator/(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator<(const MacroValue &mv) const throw (TypeError) IntMV::operator<(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of < operator"); throw TypeError("Type mismatch for operands of < operator");
return new IntMV(driver, value < mv2->value); return new IntMV(driver, value < mv2->value);
@ -206,7 +206,7 @@ IntMV::operator<(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator>(const MacroValue &mv) const throw (TypeError) IntMV::operator>(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of > operator"); throw TypeError("Type mismatch for operands of > operator");
return new IntMV(driver, value > mv2->value); return new IntMV(driver, value > mv2->value);
@ -215,7 +215,7 @@ IntMV::operator>(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator<=(const MacroValue &mv) const throw (TypeError) IntMV::operator<=(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of <= operator"); throw TypeError("Type mismatch for operands of <= operator");
return new IntMV(driver, value <= mv2->value); return new IntMV(driver, value <= mv2->value);
@ -224,7 +224,7 @@ IntMV::operator<=(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator>=(const MacroValue &mv) const throw (TypeError) IntMV::operator>=(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of >= operator"); throw TypeError("Type mismatch for operands of >= operator");
return new IntMV(driver, value >= mv2->value); return new IntMV(driver, value >= mv2->value);
@ -233,7 +233,7 @@ IntMV::operator>=(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator==(const MacroValue &mv) const throw (TypeError) IntMV::operator==(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 0); return new IntMV(driver, 0);
else else
@ -243,7 +243,7 @@ IntMV::operator==(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator!=(const MacroValue &mv) const throw (TypeError) IntMV::operator!=(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 1); return new IntMV(driver, 1);
else else
@ -253,7 +253,7 @@ IntMV::operator!=(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator&&(const MacroValue &mv) const throw (TypeError) IntMV::operator&&(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of && operator"); throw TypeError("Type mismatch for operands of && operator");
return new IntMV(driver, value && mv2->value); return new IntMV(driver, value && mv2->value);
@ -262,7 +262,7 @@ IntMV::operator&&(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::operator||(const MacroValue &mv) const throw (TypeError) IntMV::operator||(const MacroValue &mv) const throw (TypeError)
{ {
const IntMV *mv2 = dynamic_cast<const IntMV *>(&mv); const auto *mv2 = dynamic_cast<const IntMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of || operator"); throw TypeError("Type mismatch for operands of || operator");
return new IntMV(driver, value || mv2->value); return new IntMV(driver, value || mv2->value);
@ -299,7 +299,7 @@ IntMV::toArray() const
const MacroValue * const MacroValue *
IntMV::append(const MacroValue *array) const throw (TypeError) IntMV::append(const MacroValue *array) const throw (TypeError)
{ {
const ArrayMV<int> *array2 = dynamic_cast<const ArrayMV<int> *>(array); const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array);
if (array2 == NULL) if (array2 == NULL)
throw TypeError("Type mismatch for append operation"); throw TypeError("Type mismatch for append operation");
@ -311,7 +311,7 @@ IntMV::append(const MacroValue *array) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::in(const MacroValue *array) const throw (TypeError) IntMV::in(const MacroValue *array) const throw (TypeError)
{ {
const ArrayMV<int> *array2 = dynamic_cast<const ArrayMV<int> *>(array); const auto *array2 = dynamic_cast<const ArrayMV<int> *>(array);
if (array2 == NULL) if (array2 == NULL)
throw TypeError("Type mismatch for 'in' operator"); throw TypeError("Type mismatch for 'in' operator");
@ -329,8 +329,8 @@ IntMV::in(const MacroValue *array) const throw (TypeError)
const MacroValue * const MacroValue *
IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError) IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError)
{ {
const IntMV *mv1i = dynamic_cast<const IntMV *>(mv1); const auto *mv1i = dynamic_cast<const IntMV *>(mv1);
const IntMV *mv2i = dynamic_cast<const IntMV *>(mv2); const auto *mv2i = dynamic_cast<const IntMV *>(mv2);
if (mv1i == NULL || mv2i == NULL) if (mv1i == NULL || mv2i == NULL)
throw TypeError("Arguments of range operator (:) must be integers"); throw TypeError("Arguments of range operator (:) must be integers");
@ -355,7 +355,7 @@ StringMV::~StringMV()
const MacroValue * const MacroValue *
StringMV::operator+(const MacroValue &mv) const throw (TypeError) StringMV::operator+(const MacroValue &mv) const throw (TypeError)
{ {
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv); const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of + operator"); throw TypeError("Type mismatch for operands of + operator");
return new StringMV(driver, value + mv2->value); return new StringMV(driver, value + mv2->value);
@ -364,7 +364,7 @@ StringMV::operator+(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
StringMV::operator==(const MacroValue &mv) const throw (TypeError) StringMV::operator==(const MacroValue &mv) const throw (TypeError)
{ {
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv); const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 0); return new IntMV(driver, 0);
else else
@ -374,7 +374,7 @@ StringMV::operator==(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
StringMV::operator!=(const MacroValue &mv) const throw (TypeError) StringMV::operator!=(const MacroValue &mv) const throw (TypeError)
{ {
const StringMV *mv2 = dynamic_cast<const StringMV *>(&mv); const auto *mv2 = dynamic_cast<const StringMV *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 1); return new IntMV(driver, 1);
else else
@ -384,7 +384,7 @@ StringMV::operator!=(const MacroValue &mv) const throw (TypeError)
const MacroValue * const MacroValue *
StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError) StringMV::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError)
{ {
const ArrayMV<int> *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Expression inside [] must be an integer array"); throw TypeError("Expression inside [] must be an integer array");
string result; string result;
@ -421,7 +421,7 @@ StringMV::toArray() const
const MacroValue * const MacroValue *
StringMV::append(const MacroValue *array) const throw (TypeError) StringMV::append(const MacroValue *array) const throw (TypeError)
{ {
const ArrayMV<string> *array2 = dynamic_cast<const ArrayMV<string> *>(array); const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array);
if (array2 == NULL) if (array2 == NULL)
throw TypeError("Type mismatch for append operation"); throw TypeError("Type mismatch for append operation");
@ -433,7 +433,7 @@ StringMV::append(const MacroValue *array) const throw (TypeError)
const MacroValue * const MacroValue *
StringMV::in(const MacroValue *array) const throw (TypeError) StringMV::in(const MacroValue *array) const throw (TypeError)
{ {
const ArrayMV<string> *array2 = dynamic_cast<const ArrayMV<string> *>(array); const auto *array2 = dynamic_cast<const ArrayMV<string> *>(array);
if (array2 == NULL) if (array2 == NULL)
throw TypeError("Type mismatch for 'in' operator"); throw TypeError("Type mismatch for 'in' operator");

View File

@ -253,7 +253,7 @@ template<typename T>
const MacroValue * const MacroValue *
ArrayMV<T>::operator+(const MacroValue &mv) const throw (TypeError) ArrayMV<T>::operator+(const MacroValue &mv) const throw (TypeError)
{ {
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of + operator"); throw TypeError("Type mismatch for operands of + operator");
@ -266,14 +266,14 @@ template<typename T>
const MacroValue * const MacroValue *
ArrayMV<T>::operator-(const MacroValue &mv) const throw (TypeError) ArrayMV<T>::operator-(const MacroValue &mv) const throw (TypeError)
{ {
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Type mismatch for operands of - operator"); throw TypeError("Type mismatch for operands of - operator");
/* Highly inefficient algorithm for computing set difference /* Highly inefficient algorithm for computing set difference
(but vector<T> is not suited for that...) */ (but vector<T> is not suited for that...) */
vector<T> new_values; vector<T> new_values;
for (typename vector<T>::const_iterator it = values.begin(); for (auto it = values.begin();
it != values.end(); it++) it != values.end(); it++)
{ {
typename vector<T>::const_iterator it2; typename vector<T>::const_iterator it2;
@ -291,7 +291,7 @@ template<typename T>
const MacroValue * const MacroValue *
ArrayMV<T>::operator==(const MacroValue &mv) const throw (TypeError) ArrayMV<T>::operator==(const MacroValue &mv) const throw (TypeError)
{ {
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 0); return new IntMV(driver, 0);
else else
@ -302,7 +302,7 @@ template<typename T>
const MacroValue * const MacroValue *
ArrayMV<T>::operator!=(const MacroValue &mv) const throw (TypeError) ArrayMV<T>::operator!=(const MacroValue &mv) const throw (TypeError)
{ {
const ArrayMV<T> *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<T> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
return new IntMV(driver, 1); return new IntMV(driver, 1);
else else
@ -313,7 +313,7 @@ template<typename T>
const MacroValue * const MacroValue *
ArrayMV<T>::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError) ArrayMV<T>::operator[](const MacroValue &mv) const throw (TypeError, OutOfBoundsError)
{ {
const ArrayMV<int> *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv); const auto *mv2 = dynamic_cast<const ArrayMV<int> *>(&mv);
if (mv2 == NULL) if (mv2 == NULL)
throw TypeError("Expression inside [] must be an integer array"); throw TypeError("Expression inside [] must be an integer array");
vector<T> result; vector<T> result;
@ -335,7 +335,7 @@ string
ArrayMV<T>::toString() const ArrayMV<T>::toString() const
{ {
ostringstream ss; ostringstream ss;
for (typename vector<T>::const_iterator it = values.begin(); for (auto it = values.begin();
it != values.end(); it++) it != values.end(); it++)
ss << *it; ss << *it;
return ss.str(); return ss.str();
@ -348,7 +348,7 @@ ArrayMV<T>::print() const
bool printStrArr = false; bool printStrArr = false;
try try
{ {
typename vector<T>::const_iterator it = values.begin(); auto it = values.begin();
boost::lexical_cast<int>(*it); boost::lexical_cast<int>(*it);
} }
catch (boost::bad_lexical_cast &) catch (boost::bad_lexical_cast &)
@ -360,7 +360,7 @@ ArrayMV<T>::print() const
ss << "{"; ss << "{";
else else
ss << "["; ss << "[";
for (typename vector<T>::const_iterator it = values.begin(); for (auto it = values.begin();
it != values.end(); it++) it != values.end(); it++)
{ {
if (it != values.begin()) if (it != values.begin())