Commit 33b13599 authored by Sébastien Villemot's avatar Sébastien Villemot

Port to C++11 emplace_back() method on containers

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

Manual intervention was needed to transform a NULL into nullptr in SymbolTable.cc.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html
parent a185ecf7
...@@ -3377,7 +3377,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de ...@@ -3377,7 +3377,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
if ((i < n_obs) || (i >= nb_diag + n_obs) || (j1 >= nb_diag)) if ((i < n_obs) || (i >= nb_diag + n_obs) || (j1 >= nb_diag))
for (int k = n_obs; k < i_nz_state_var[i]; k++) for (int k = n_obs; k < i_nz_state_var[i]; k++)
{ {
v_index_KF.push_back(make_pair(i + j1 * n, make_pair(i + k * n, k + j1_n_state))); v_index_KF.emplace_back(i + j1 * n, make_pair(i + k * n, k + j1_n_state));
} }
} }
int size_v_index_KF = v_index_KF.size(); int size_v_index_KF = v_index_KF.size();
...@@ -3396,7 +3396,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de ...@@ -3396,7 +3396,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
for (int k = n_obs; k < i_nz_state_var[j]; k++) for (int k = n_obs; k < i_nz_state_var[j]; k++)
{ {
int k_n = k * n; int k_n = k * n;
v_index_KF_2.push_back(make_pair(i * n + j, make_pair(i + k_n - n_n_obs, j + k_n))); v_index_KF_2.emplace_back(i * n + j, make_pair(i + k_n - n_n_obs, j + k_n));
} }
} }
int size_v_index_KF_2 = v_index_KF_2.size(); int size_v_index_KF_2 = v_index_KF_2.size();
...@@ -4351,7 +4351,7 @@ DynamicModel::collectBlockVariables() ...@@ -4351,7 +4351,7 @@ DynamicModel::collectBlockVariables()
} }
} }
} }
block_var_exo.push_back(make_pair(tmp_var_exo, count_col_exo)); block_var_exo.emplace_back(tmp_var_exo, count_col_exo);
} }
} }
......
...@@ -2703,55 +2703,55 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_ ...@@ -2703,55 +2703,55 @@ UnaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr_
switch (op_code) switch (op_code)
{ {
case oUminus: case oUminus:
List_of_Op_RHS.push_back(make_pair(oUminus, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oUminus, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oExp: case oExp:
List_of_Op_RHS.push_back(make_pair(oLog, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oLog, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oLog: case oLog:
List_of_Op_RHS.push_back(make_pair(oExp, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oExp, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oLog10: case oLog10:
List_of_Op_RHS.push_back(make_pair(oPower, make_pair((expr_t) NULL, datatree.AddNonNegativeConstant("10")))); List_of_Op_RHS.emplace_back(oPower, make_pair((expr_t) NULL, datatree.AddNonNegativeConstant("10")));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oCos: case oCos:
List_of_Op_RHS.push_back(make_pair(oAcos, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAcos, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oSin: case oSin:
List_of_Op_RHS.push_back(make_pair(oAsin, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAsin, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oTan: case oTan:
List_of_Op_RHS.push_back(make_pair(oAtan, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAtan, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAcos: case oAcos:
List_of_Op_RHS.push_back(make_pair(oCos, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oCos, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAsin: case oAsin:
List_of_Op_RHS.push_back(make_pair(oSin, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oSin, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAtan: case oAtan:
List_of_Op_RHS.push_back(make_pair(oTan, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oTan, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oCosh: case oCosh:
List_of_Op_RHS.push_back(make_pair(oAcosh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAcosh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oSinh: case oSinh:
List_of_Op_RHS.push_back(make_pair(oAsinh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAsinh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oTanh: case oTanh:
List_of_Op_RHS.push_back(make_pair(oAtanh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oAtanh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAcosh: case oAcosh:
List_of_Op_RHS.push_back(make_pair(oCosh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oCosh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAsinh: case oAsinh:
List_of_Op_RHS.push_back(make_pair(oSinh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oSinh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAtanh: case oAtanh:
List_of_Op_RHS.push_back(make_pair(oTanh, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oTanh, make_pair((expr_t) NULL, (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oSqrt: case oSqrt:
List_of_Op_RHS.push_back(make_pair(oPower, make_pair((expr_t) NULL, datatree.Two))); List_of_Op_RHS.emplace_back(oPower, make_pair((expr_t) NULL, datatree.Two));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
case oAbs: case oAbs:
return (make_pair(2, (expr_t) NULL)); return (make_pair(2, (expr_t) NULL));
...@@ -4465,39 +4465,39 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr ...@@ -4465,39 +4465,39 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
case oPlus: case oPlus:
if (!is_endogenous_present_1 && !is_endogenous_present_2) if (!is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oMinus, make_pair(datatree.AddPlus(expr_t_1, expr_t_2), (expr_t) NULL))); List_of_Op_RHS.emplace_back(oMinus, make_pair(datatree.AddPlus(expr_t_1, expr_t_2), (expr_t) NULL));
return (make_pair(0, datatree.AddPlus(expr_t_1, expr_t_2))); return (make_pair(0, datatree.AddPlus(expr_t_1, expr_t_2)));
} }
else if (is_endogenous_present_1 && is_endogenous_present_2) else if (is_endogenous_present_1 && is_endogenous_present_2)
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
else if (!is_endogenous_present_1 && is_endogenous_present_2) else if (!is_endogenous_present_1 && is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oMinus, make_pair(expr_t_1, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oMinus, make_pair(expr_t_1, (expr_t) NULL));
return (make_pair(1, expr_t_1)); return (make_pair(1, expr_t_1));
} }
else if (is_endogenous_present_1 && !is_endogenous_present_2) else if (is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oMinus, make_pair(expr_t_2, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oMinus, make_pair(expr_t_2, (expr_t) NULL));
return (make_pair(1, expr_t_2)); return (make_pair(1, expr_t_2));
} }
break; break;
case oMinus: case oMinus:
if (!is_endogenous_present_1 && !is_endogenous_present_2) if (!is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oMinus, make_pair(datatree.AddMinus(expr_t_1, expr_t_2), (expr_t) NULL))); List_of_Op_RHS.emplace_back(oMinus, make_pair(datatree.AddMinus(expr_t_1, expr_t_2), (expr_t) NULL));
return (make_pair(0, datatree.AddMinus(expr_t_1, expr_t_2))); return (make_pair(0, datatree.AddMinus(expr_t_1, expr_t_2)));
} }
else if (is_endogenous_present_1 && is_endogenous_present_2) else if (is_endogenous_present_1 && is_endogenous_present_2)
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
else if (!is_endogenous_present_1 && is_endogenous_present_2) else if (!is_endogenous_present_1 && is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oUminus, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oUminus, make_pair((expr_t) NULL, (expr_t) NULL));
List_of_Op_RHS.push_back(make_pair(oMinus, make_pair(expr_t_1, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oMinus, make_pair(expr_t_1, (expr_t) NULL));
return (make_pair(1, expr_t_1)); return (make_pair(1, expr_t_1));
} }
else if (is_endogenous_present_1 && !is_endogenous_present_2) else if (is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oPlus, make_pair(expr_t_2, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oPlus, make_pair(expr_t_2, (expr_t) NULL));
return (make_pair(1, datatree.AddUMinus(expr_t_2))); return (make_pair(1, datatree.AddUMinus(expr_t_2)));
} }
break; break;
...@@ -4506,12 +4506,12 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr ...@@ -4506,12 +4506,12 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
return (make_pair(0, datatree.AddTimes(expr_t_1, expr_t_2))); return (make_pair(0, datatree.AddTimes(expr_t_1, expr_t_2)));
else if (!is_endogenous_present_1 && is_endogenous_present_2) else if (!is_endogenous_present_1 && is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oDivide, make_pair(expr_t_1, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oDivide, make_pair(expr_t_1, (expr_t) NULL));
return (make_pair(1, expr_t_1)); return (make_pair(1, expr_t_1));
} }
else if (is_endogenous_present_1 && !is_endogenous_present_2) else if (is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oDivide, make_pair(expr_t_2, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oDivide, make_pair(expr_t_2, (expr_t) NULL));
return (make_pair(1, expr_t_2)); return (make_pair(1, expr_t_2));
} }
else else
...@@ -4522,12 +4522,12 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr ...@@ -4522,12 +4522,12 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
return (make_pair(0, datatree.AddDivide(expr_t_1, expr_t_2))); return (make_pair(0, datatree.AddDivide(expr_t_1, expr_t_2)));
else if (!is_endogenous_present_1 && is_endogenous_present_2) else if (!is_endogenous_present_1 && is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oDivide, make_pair((expr_t) NULL, expr_t_1))); List_of_Op_RHS.emplace_back(oDivide, make_pair((expr_t) NULL, expr_t_1));
return (make_pair(1, expr_t_1)); return (make_pair(1, expr_t_1));
} }
else if (is_endogenous_present_1 && !is_endogenous_present_2) else if (is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oTimes, make_pair(expr_t_2, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oTimes, make_pair(expr_t_2, (expr_t) NULL));
return (make_pair(1, expr_t_2)); return (make_pair(1, expr_t_2));
} }
else else
...@@ -4538,16 +4538,16 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr ...@@ -4538,16 +4538,16 @@ BinaryOpNode::normalizeEquation(int var_endo, vector<pair<int, pair<expr_t, expr
return (make_pair(0, datatree.AddPower(expr_t_1, expr_t_2))); return (make_pair(0, datatree.AddPower(expr_t_1, expr_t_2)));
else if (is_endogenous_present_1 && !is_endogenous_present_2) else if (is_endogenous_present_1 && !is_endogenous_present_2)
{ {
List_of_Op_RHS.push_back(make_pair(oPower, make_pair(datatree.AddDivide(datatree.One, expr_t_2), (expr_t) NULL))); List_of_Op_RHS.emplace_back(oPower, make_pair(datatree.AddDivide(datatree.One, expr_t_2), (expr_t) NULL));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
} }
else if (!is_endogenous_present_1 && is_endogenous_present_2) else if (!is_endogenous_present_1 && is_endogenous_present_2)
{ {
/* we have to nomalize a^f(X) = RHS */ /* we have to nomalize a^f(X) = RHS */
/* First computes the ln(RHS)*/ /* First computes the ln(RHS)*/
List_of_Op_RHS.push_back(make_pair(oLog, make_pair((expr_t) NULL, (expr_t) NULL))); List_of_Op_RHS.emplace_back(oLog, make_pair((expr_t) NULL, (expr_t) NULL));
/* Second computes f(X) = ln(RHS) / ln(a)*/ /* Second computes f(X) = ln(RHS) / ln(a)*/
List_of_Op_RHS.push_back(make_pair(oDivide, make_pair((expr_t) NULL, datatree.AddLog(expr_t_1)))); List_of_Op_RHS.emplace_back(oDivide, make_pair((expr_t) NULL, datatree.AddLog(expr_t_1)));
return (make_pair(1, (expr_t) NULL)); return (make_pair(1, (expr_t) NULL));
} }
break; break;
...@@ -6447,7 +6447,7 @@ AbstractExternalFunctionNode::normalizeEquation(int var_endo, vector<pair<int, p ...@@ -6447,7 +6447,7 @@ AbstractExternalFunctionNode::normalizeEquation(int var_endo, vector<pair<int, p
bool present = false; bool present = false;
for (auto argument : arguments) for (auto argument : arguments)
{ {
V_arguments.push_back(argument->normalizeEquation(var_endo, List_of_Op_RHS)); V_arguments.emplace_back(argument->normalizeEquation(var_endo, List_of_Op_RHS));
present = present || V_arguments[V_arguments.size()-1].first; present = present || V_arguments[V_arguments.size()-1].first;
V_expr_t.push_back(V_arguments[V_arguments.size()-1].second); V_expr_t.push_back(V_arguments[V_arguments.size()-1].second);
} }
......
...@@ -918,21 +918,21 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j ...@@ -918,21 +918,21 @@ ModelTree::reduceBlocksAndTypeDetermination(const dynamic_jacob_map_t &dynamic_j
{ {
block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size))); block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size)));
block_lag_lead.push_back(make_pair(Lag, Lead)); block_lag_lead.push_back(make_pair(Lag, Lead));
block_col_type.push_back(make_pair(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed))); block_col_type.emplace_back(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed));
} }
} }
else else
{ {
block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size))); block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size)));
block_lag_lead.push_back(make_pair(Lag, Lead)); block_lag_lead.push_back(make_pair(Lag, Lead));
block_col_type.push_back(make_pair(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed))); block_col_type.emplace_back(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed));
} }
} }
else else
{ {
block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size))); block_type_size_mfs.push_back(make_pair(make_pair(Simulation_Type, eq), make_pair(Blck_Size, MFS_Size)));
block_lag_lead.push_back(make_pair(Lag, Lead)); block_lag_lead.push_back(make_pair(Lag, Lead));
block_col_type.push_back(make_pair(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed))); block_col_type.emplace_back(make_pair(l_n_static, l_n_forward), make_pair(l_n_backward, l_n_mixed));
} }
prev_Type = Simulation_Type; prev_Type = Simulation_Type;
eq += Blck_Size; eq += Blck_Size;
...@@ -1745,7 +1745,7 @@ ModelTree::addEquation(expr_t eq, int lineno, const vector<pair<string, string> ...@@ -1745,7 +1745,7 @@ ModelTree::addEquation(expr_t eq, int lineno, const vector<pair<string, string>
{ {
int n = equations.size(); int n = equations.size();
for (const auto & eq_tag : eq_tags) for (const auto & eq_tag : eq_tags)
equation_tags.push_back(make_pair(n, eq_tag)); equation_tags.emplace_back(n, eq_tag);
addEquation(eq, lineno); addEquation(eq, lineno);
} }
......
...@@ -144,7 +144,7 @@ ParsingDriver::create_error_string(const Dynare::parser::location_type &l, const ...@@ -144,7 +144,7 @@ ParsingDriver::create_error_string(const Dynare::parser::location_type &l, const
{ {
ostringstream stream; ostringstream stream;
create_error_string(l, m, stream); create_error_string(l, m, stream);
model_errors.push_back(make_pair(var, stream.str())); model_errors.emplace_back(var, stream.str());
} }
void void
...@@ -173,7 +173,7 @@ ParsingDriver::undeclared_model_variable_error(const string &m, const string &va ...@@ -173,7 +173,7 @@ ParsingDriver::undeclared_model_variable_error(const string &m, const string &va
stream << m; stream << m;
if (nostrict) if (nostrict)
stream << " automatically declared exogenous."; stream << " automatically declared exogenous.";
undeclared_model_variable_errors.push_back(make_pair(var, stream.str())); undeclared_model_variable_errors.emplace_back(var, stream.str());
} }
void void
...@@ -370,7 +370,7 @@ ParsingDriver::add_predetermined_variable(string *name) ...@@ -370,7 +370,7 @@ ParsingDriver::add_predetermined_variable(string *name)
void void
ParsingDriver::add_equation_tags(string *key, string *value) ParsingDriver::add_equation_tags(string *key, string *value)
{ {
eq_tags.push_back(make_pair(*key, *value)); eq_tags.emplace_back(*key, *value);
delete key; delete key;
delete value; delete value;
} }
...@@ -623,7 +623,7 @@ ParsingDriver::add_VAR_restriction_coeff(string *name1, string *name2, string *l ...@@ -623,7 +623,7 @@ ParsingDriver::add_VAR_restriction_coeff(string *name1, string *name2, string *l
void void
ParsingDriver::add_VAR_restriction_eq_or_crosseq(expr_t expr) ParsingDriver::add_VAR_restriction_eq_or_crosseq(expr_t expr)
{ {
var_restriction_eq_or_crosseq.push_back(make_pair(var_restriction_coeff, expr)); var_restriction_eq_or_crosseq.emplace_back(var_restriction_coeff, expr);
} }
void void
...@@ -1182,7 +1182,7 @@ ParsingDriver::add_period(string *p1, string *p2) ...@@ -1182,7 +1182,7 @@ ParsingDriver::add_period(string *p1, string *p2)
int p2_val = atoi(p2->c_str()); int p2_val = atoi(p2->c_str());
if (p1_val > p2_val) if (p1_val > p2_val)
error("shocks/conditional_forecast_paths: can't have first period index greater than second index in range specification"); error("shocks/conditional_forecast_paths: can't have first period index greater than second index in range specification");
det_shocks_periods.push_back(make_pair(p1_val, p2_val)); det_shocks_periods.emplace_back(p1_val, p2_val);
delete p1; delete p1;
delete p2; delete p2;
} }
...@@ -1191,7 +1191,7 @@ void ...@@ -1191,7 +1191,7 @@ void
ParsingDriver::add_period(string *p1) ParsingDriver::add_period(string *p1)
{ {
int p1_val = atoi(p1->c_str()); int p1_val = atoi(p1->c_str());
det_shocks_periods.push_back(make_pair(p1_val, p1_val)); det_shocks_periods.emplace_back(p1_val, p1_val);
delete p1; delete p1;
} }
......
...@@ -39,7 +39,7 @@ SteadyStateModel::addDefinition(int symb_id, expr_t expr) ...@@ -39,7 +39,7 @@ SteadyStateModel::addDefinition(int symb_id, expr_t expr)
// Add the variable // Add the variable
vector<int> v; vector<int> v;
v.push_back(symb_id); v.push_back(symb_id);
def_table.push_back(make_pair(v, expr)); def_table.emplace_back(v, expr);
} }
void void
...@@ -52,7 +52,7 @@ SteadyStateModel::addMultipleDefinitions(const vector<int> &symb_ids, expr_t exp ...@@ -52,7 +52,7 @@ SteadyStateModel::addMultipleDefinitions(const vector<int> &symb_ids, expr_t exp
|| symbol_table.getType(symb_id) == eModFileLocalVariable || symbol_table.getType(symb_id) == eModFileLocalVariable
|| symbol_table.getType(symb_id) == eParameter); || symbol_table.getType(symb_id) == eParameter);
} }
def_table.push_back(make_pair(symb_ids, expr)); def_table.emplace_back(symb_ids, expr);
} }
void void
......
...@@ -624,7 +624,7 @@ SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg) ...@@ -624,7 +624,7 @@ SymbolTable::addLeadAuxiliaryVarInternal(bool endo, int index, expr_t expr_arg)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, (endo ? avEndoLead : avExoLead), 0, 0, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, (endo ? avEndoLead : avExoLead), 0, 0, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -650,7 +650,7 @@ SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_le ...@@ -650,7 +650,7 @@ SymbolTable::addLagAuxiliaryVarInternal(bool endo, int orig_symb_id, int orig_le
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, (endo ? avEndoLag : avExoLag), orig_symb_id, orig_lead_lag, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, (endo ? avEndoLag : avExoLag), orig_symb_id, orig_lead_lag, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -698,7 +698,7 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t e ...@@ -698,7 +698,7 @@ SymbolTable::addExpectationAuxiliaryVar(int information_set, int index, expr_t e
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avExpectation, 0, 0, 0, information_set, expr_arg)); aux_vars.emplace_back(symb_id, avExpectation, 0, 0, 0, information_set, expr_arg);
return symb_id; return symb_id;
} }
...@@ -721,7 +721,7 @@ SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id ...@@ -721,7 +721,7 @@ SymbolTable::addDiffLagAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avDiffLag, orig_symb_id, orig_lag, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, avDiffLag, orig_symb_id, orig_lag, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -744,7 +744,7 @@ SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, i ...@@ -744,7 +744,7 @@ SymbolTable::addDiffAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id, i
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avDiff, orig_symb_id, orig_lag, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, avDiff, orig_symb_id, orig_lag, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -772,7 +772,7 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id ...@@ -772,7 +772,7 @@ SymbolTable::addUnaryOpAuxiliaryVar(int index, expr_t expr_arg, int orig_symb_id
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avUnaryOp, orig_symb_id, orig_lag, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, avUnaryOp, orig_symb_id, orig_lag, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -794,7 +794,7 @@ SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag, ...@@ -794,7 +794,7 @@ SymbolTable::addVarModelEndoLagAuxiliaryVar(int orig_symb_id, int orig_lead_lag,
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avVarModel, orig_symb_id, orig_lead_lag, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, avVarModel, orig_symb_id, orig_lead_lag, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
...@@ -816,7 +816,7 @@ SymbolTable::addMultiplierAuxiliaryVar(int index) throw (FrozenException) ...@@ -816,7 +816,7 @@ SymbolTable::addMultiplierAuxiliaryVar(int index) throw (FrozenException)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avMultiplier, 0, 0, index, 0, NULL)); aux_vars.emplace_back(symb_id, avMultiplier, 0, 0, index, 0, nullptr);
return symb_id; return symb_id;
} }
...@@ -837,7 +837,7 @@ SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) throw ...@@ -837,7 +837,7 @@ SymbolTable::addDiffForwardAuxiliaryVar(int orig_symb_id, expr_t expr_arg) throw
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
aux_vars.push_back(AuxVarInfo(symb_id, avDiffForward, orig_symb_id, 0, 0, 0, expr_arg)); aux_vars.emplace_back(symb_id, avDiffForward, orig_symb_id, 0, 0, 0, expr_arg);
return symb_id; return symb_id;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment