C++17 modernization: take advantage of class template argument deduction
parent
0b5c88109f
commit
9ace2dc413
|
@ -1257,7 +1257,7 @@ AbstractEstimatedParamsStatement::commonCheckPass() const
|
|||
if (it.type == 3) // Correlation
|
||||
{
|
||||
// Use lexical ordering for the pair of symbols
|
||||
auto x = it.name < it.name2 ? make_pair(it.name, it.name2) : make_pair(it.name2, it.name);
|
||||
auto x = it.name < it.name2 ? pair{it.name, it.name2} : pair{it.name2, it.name};
|
||||
|
||||
if (already_declared_corr.contains(x))
|
||||
{
|
||||
|
@ -3528,10 +3528,10 @@ MarkovSwitchingStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
|
|||
auto it_num_regimes = options_list.num_options.find("ms.number_of_regimes");
|
||||
assert(it_num_regimes != options_list.num_options.end());
|
||||
auto num_regimes = stoi(it_num_regimes->second);
|
||||
vector<double> col_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_col(num_regimes, true);
|
||||
vector col_trans_prob_sum(num_regimes, 0.0);
|
||||
vector row_trans_prob_sum(num_regimes, 0.0);
|
||||
vector all_restrictions_in_row(num_regimes, true);
|
||||
vector all_restrictions_in_col(num_regimes, true);
|
||||
for (int row = 0; row < num_regimes; row++)
|
||||
for (int col = 0; col < num_regimes; col++)
|
||||
if (restriction_map.contains({ row+1, col+1 }))
|
||||
|
|
|
@ -380,8 +380,8 @@ ConfigFile::getConfigFileInfo(const string &config_file)
|
|||
operatingSystem = tokenizedLine.back();
|
||||
else if (!tokenizedLine.front().compare("Members"))
|
||||
{
|
||||
char_separator<char> sep(" ,;", "()", drop_empty_tokens);
|
||||
tokenizer<char_separator<char>> tokens(tokenizedLine.back(), sep);
|
||||
char_separator sep(" ,;", "()", drop_empty_tokens);
|
||||
tokenizer tokens(tokenizedLine.back(), sep);
|
||||
bool begin_weight = false;
|
||||
string node_name;
|
||||
for (const auto &token : tokens)
|
||||
|
|
|
@ -2564,7 +2564,7 @@ DynamicModel::removeEquations(const vector<pair<string, string>> &listed_eqs_by_
|
|||
bool excluded_vars_change_type)
|
||||
{
|
||||
/* Convert the const vector to a (mutable) set */
|
||||
set<pair<string, string>> listed_eqs_by_tag2(listed_eqs_by_tag.begin(), listed_eqs_by_tag.end());
|
||||
set listed_eqs_by_tag2(listed_eqs_by_tag.begin(), listed_eqs_by_tag.end());
|
||||
|
||||
vector<int> excluded_vars = removeEquationsHelper(listed_eqs_by_tag2, exclude_eqs,
|
||||
excluded_vars_change_type,
|
||||
|
|
|
@ -356,7 +356,7 @@ ExprNode::fillErrorCorrectionRow(int eqn,
|
|||
datatree.AddPossiblyNegativeConstant(-constant));
|
||||
if (param_id)
|
||||
e = datatree.AddTimes(e, datatree.AddVariable(*param_id));
|
||||
if (auto coor = make_pair(eqn, colidx); A0star.contains(coor))
|
||||
if (pair coor{eqn, colidx}; A0star.contains(coor))
|
||||
A0star[coor] = datatree.AddPlus(e, A0star[coor]);
|
||||
else
|
||||
A0star[coor] = e;
|
||||
|
|
|
@ -1414,7 +1414,7 @@ ModFile::unique_path()
|
|||
string possible_characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
random_device rd;
|
||||
mt19937 generator(rd());
|
||||
uniform_int_distribution<int> distribution{0, static_cast<int>(possible_characters.size())-1};
|
||||
uniform_int_distribution distribution{0, static_cast<int>(possible_characters.size())-1};
|
||||
do
|
||||
{
|
||||
constexpr int rand_length = 10;
|
||||
|
|
|
@ -64,7 +64,7 @@ SteadyStateModel::addDefinition(int symb_id, expr_t expr)
|
|||
|| symbol_table.getType(symb_id) == SymbolType::parameter);
|
||||
|
||||
// Add the variable
|
||||
vector<int> v{symb_id};
|
||||
vector v{symb_id};
|
||||
def_table.emplace_back(v, expr);
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ ModelTree::computeNonSingularNormalization(const jacob_map_t &contemporaneous_ja
|
|||
int n = equations.size();
|
||||
|
||||
// Compute the maximum value of each row of the contemporaneous Jacobian matrix
|
||||
vector<double> max_val(n, 0.0);
|
||||
vector max_val(n, 0.0);
|
||||
for (const auto &[eq_and_endo, val] : contemporaneous_jacobian)
|
||||
max_val[eq_and_endo.first] = max(max_val[eq_and_endo.first], fabs(val));
|
||||
|
||||
|
@ -378,7 +378,7 @@ ModelTree::computePrologueAndEpilogue()
|
|||
(resp. column) indices are to be interpreted according to
|
||||
“eq_idx_block2orig” (resp. “endo_idx_block2orig”). Stored in row-major
|
||||
order. */
|
||||
vector<bool> IM(n*n, false);
|
||||
vector IM(n*n, false);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
set<pair<int, int>> endos_and_lags;
|
||||
|
@ -507,7 +507,7 @@ ModelTree::equationTypeDetermination(const map<tuple<int, int, int>, expr_t> &fi
|
|||
void
|
||||
ModelTree::computeDynamicStructureOfBlock(int blk)
|
||||
{
|
||||
vector<pair<int, int>> max_endo_lag_lead(blocks[blk].size, { 0, 0 });
|
||||
vector max_endo_lag_lead(blocks[blk].size, pair{0, 0});
|
||||
blocks[blk].max_endo_lag = blocks[blk].max_endo_lead = 0;
|
||||
blocks[blk].max_other_endo_lag = blocks[blk].max_other_endo_lead = 0;
|
||||
blocks[blk].max_exo_lag = blocks[blk].max_exo_lead = 0;
|
||||
|
@ -716,8 +716,7 @@ ModelTree::computeBlockDecomposition(int prologue, int epilogue)
|
|||
auto recursive_vertices = subG.reorderRecursiveVariables(feed_back_vertices);
|
||||
auto v_index1 = get(boost::vertex_index1, subG);
|
||||
|
||||
const vector<pair<int, int>> dynamic_order{ make_pair(0, 0), make_pair(1, 0),
|
||||
make_pair(1, 1), make_pair(0, 1) };
|
||||
const vector dynamic_order{pair{0, 0}, pair{1, 0}, pair{1, 1}, pair{0, 1}};
|
||||
|
||||
// First the recursive equations conditional on feedback variables
|
||||
for (auto max_lag_lead : dynamic_order)
|
||||
|
|
|
@ -584,7 +584,7 @@ ParsingDriver::hist_val(const string &name, const string &lag, expr_t rhs)
|
|||
if (ilag > 0)
|
||||
error("histval: the lag on " + name + " should be less than or equal to 0");
|
||||
|
||||
pair<int, int> key(symb_id, ilag);
|
||||
pair key{symb_id, ilag};
|
||||
|
||||
if (hist_values.contains(key))
|
||||
error("hist_val: (" + name + ", " + lag + ") declared twice");
|
||||
|
@ -1075,7 +1075,7 @@ ParsingDriver::add_covar_shock(const string &var1, const string &var2, expr_t va
|
|||
int symb_id1 = mod_file->symbol_table.getID(var1);
|
||||
int symb_id2 = mod_file->symbol_table.getID(var2);
|
||||
|
||||
pair<int, int> key(symb_id1, symb_id2), key_inv(symb_id2, symb_id1);
|
||||
pair key{symb_id1, symb_id2}, key_inv{symb_id2, symb_id1};
|
||||
|
||||
if (covar_shocks.contains(key) || covar_shocks.contains(key_inv)
|
||||
|| corr_shocks.contains(key) || corr_shocks.contains(key_inv))
|
||||
|
@ -1100,7 +1100,7 @@ ParsingDriver::add_correl_shock(const string &var1, const string &var2, expr_t v
|
|||
int symb_id1 = mod_file->symbol_table.getID(var1);
|
||||
int symb_id2 = mod_file->symbol_table.getID(var2);
|
||||
|
||||
pair<int, int> key(symb_id1, symb_id2), key_inv(symb_id2, symb_id1);
|
||||
pair key{symb_id1, symb_id2}, key_inv{symb_id2, symb_id1};
|
||||
|
||||
if (covar_shocks.contains(key) || covar_shocks.contains(key_inv)
|
||||
|| corr_shocks.contains(key) || corr_shocks.contains(key_inv))
|
||||
|
@ -2070,7 +2070,7 @@ ParsingDriver::set_optim_weights(const string &name1, const string &name2, expr_
|
|||
check_symbol_is_endogenous(name1);
|
||||
check_symbol_is_endogenous(name2);
|
||||
|
||||
pair<string, string> covar_key{name1, name2};
|
||||
pair covar_key{name1, name2};
|
||||
|
||||
if (covar_weights.contains(covar_key))
|
||||
error("optim_weights: pair of variables (" + name1 + ", " + name2
|
||||
|
|
Loading…
Reference in New Issue