Do not use C++20 aggregate initialization with parentheses
Initialization with initalizer list is nicer. And, more importantly, initialization with parentheses is not supported by Clang < 16.master
parent
92f42bdf68
commit
e1e1a753d0
|
@ -734,7 +734,7 @@ DataTree::AddLocalVariable(int symb_id, expr_t value) noexcept(false)
|
|||
|
||||
// Throw an exception if symbol already declared
|
||||
if (local_variables_table.contains(symb_id))
|
||||
throw LocalVariableException(symbol_table.getName(symb_id));
|
||||
throw LocalVariableException{symbol_table.getName(symb_id)};
|
||||
|
||||
local_variables_table.emplace(symb_id, value);
|
||||
local_variables_vector.push_back(symb_id);
|
||||
|
|
|
@ -353,7 +353,7 @@ public:
|
|||
{
|
||||
auto it = local_variables_table.find(symb_id);
|
||||
if (it == local_variables_table.end())
|
||||
throw UnknownLocalVariableException(symb_id);
|
||||
throw UnknownLocalVariableException{symb_id};
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
|
|
@ -5833,18 +5833,18 @@ BinaryOpNode::matchMatchedMoment(vector<int> &symb_ids, vector<int> &lags, vecto
|
|||
else if (op_code == BinaryOpcode::power)
|
||||
{
|
||||
if (!dynamic_cast<const VariableNode *>(arg1))
|
||||
throw MatchFailureException("First argument of power expression must be a variable");
|
||||
throw MatchFailureException{"First argument of power expression must be a variable"};
|
||||
auto ncn = dynamic_cast<const NumConstNode *>(arg2);
|
||||
if (!ncn)
|
||||
throw MatchFailureException("Second argument of power expression must be a positive integer");
|
||||
throw MatchFailureException{"Second argument of power expression must be a positive integer"};
|
||||
double c = datatree.num_constants.getDouble(ncn->id);
|
||||
if (c <= 0 || round(c) != c)
|
||||
throw MatchFailureException("Second argument of power expression must be a positive integer");
|
||||
throw MatchFailureException{"Second argument of power expression must be a positive integer"};
|
||||
arg1->matchMatchedMoment(symb_ids, lags, powers);
|
||||
powers.back() = static_cast<int>(c);
|
||||
}
|
||||
else
|
||||
throw MatchFailureException("Unsupported binary operator");
|
||||
throw MatchFailureException{"Unsupported binary operator"};
|
||||
}
|
||||
|
||||
expr_t
|
||||
|
|
|
@ -84,7 +84,7 @@ ExternalFunctionsTable::getNargs(int symb_id) const noexcept(false)
|
|||
it != externalFunctionTable.end())
|
||||
return it->second.nargs;
|
||||
else
|
||||
throw UnknownExternalFunctionSymbolIDException(symb_id);
|
||||
throw UnknownExternalFunctionSymbolIDException{symb_id};
|
||||
}
|
||||
|
||||
inline int
|
||||
|
@ -94,7 +94,7 @@ ExternalFunctionsTable::getFirstDerivSymbID(int symb_id) const noexcept(false)
|
|||
it != externalFunctionTable.end())
|
||||
return it->second.firstDerivSymbID;
|
||||
else
|
||||
throw UnknownExternalFunctionSymbolIDException(symb_id);
|
||||
throw UnknownExternalFunctionSymbolIDException{symb_id};
|
||||
}
|
||||
|
||||
inline int
|
||||
|
@ -104,7 +104,7 @@ ExternalFunctionsTable::getSecondDerivSymbID(int symb_id) const noexcept(false)
|
|||
it != externalFunctionTable.end())
|
||||
return it->second.secondDerivSymbID;
|
||||
else
|
||||
throw UnknownExternalFunctionSymbolIDException(symb_id);
|
||||
throw UnknownExternalFunctionSymbolIDException{symb_id};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1419,7 +1419,7 @@ ModelTree::addTrendVariables(const vector<int> &trend_vars, expr_t growth_factor
|
|||
{
|
||||
for (int id : trend_vars)
|
||||
if (trend_symbols_map.contains(id))
|
||||
throw TrendException(symbol_table.getName(id));
|
||||
throw TrendException{symbol_table.getName(id)};
|
||||
else
|
||||
trend_symbols_map[id] = growth_factor;
|
||||
}
|
||||
|
@ -1429,7 +1429,7 @@ ModelTree::addNonstationaryVariables(const vector<int> &nonstationary_vars, bool
|
|||
{
|
||||
for (int id : nonstationary_vars)
|
||||
if (nonstationary_symbols_map.contains(id))
|
||||
throw TrendException(symbol_table.getName(id));
|
||||
throw TrendException{symbol_table.getName(id)};
|
||||
else
|
||||
nonstationary_symbols_map[id] = { log_deflator, deflator };
|
||||
}
|
||||
|
|
|
@ -38,9 +38,9 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
|
|||
if (exists(name))
|
||||
{
|
||||
if (type_table[getID(name)] == type)
|
||||
throw AlreadyDeclaredException(name, true);
|
||||
throw AlreadyDeclaredException{name, true};
|
||||
else
|
||||
throw AlreadyDeclaredException(name, false);
|
||||
throw AlreadyDeclaredException{name, false};
|
||||
}
|
||||
|
||||
string final_tex_name = tex_name;
|
||||
|
@ -154,26 +154,26 @@ SymbolTable::getID(SymbolType type, int tsid) const noexcept(false)
|
|||
{
|
||||
case SymbolType::endogenous:
|
||||
if (tsid < 0 || tsid >= static_cast<int>(endo_ids.size()))
|
||||
throw UnknownTypeSpecificIDException(tsid, type);
|
||||
throw UnknownTypeSpecificIDException{tsid, type};
|
||||
else
|
||||
return endo_ids[tsid];
|
||||
case SymbolType::exogenous:
|
||||
if (tsid < 0 || tsid >= static_cast<int>(exo_ids.size()))
|
||||
throw UnknownTypeSpecificIDException(tsid, type);
|
||||
throw UnknownTypeSpecificIDException{tsid, type};
|
||||
else
|
||||
return exo_ids[tsid];
|
||||
case SymbolType::exogenousDet:
|
||||
if (tsid < 0 || tsid >= static_cast<int>(exo_det_ids.size()))
|
||||
throw UnknownTypeSpecificIDException(tsid, type);
|
||||
throw UnknownTypeSpecificIDException{tsid, type};
|
||||
else
|
||||
return exo_det_ids[tsid];
|
||||
case SymbolType::parameter:
|
||||
if (tsid < 0 || tsid >= static_cast<int>(param_ids.size()))
|
||||
throw UnknownTypeSpecificIDException(tsid, type);
|
||||
throw UnknownTypeSpecificIDException{tsid, type};
|
||||
else
|
||||
return param_ids[tsid];
|
||||
default:
|
||||
throw UnknownTypeSpecificIDException(tsid, type);
|
||||
throw UnknownTypeSpecificIDException{tsid, type};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ SymbolTable::searchAuxiliaryVars(int orig_symb_id, int orig_lead_lag) const noex
|
|||
if ((aux_var.type == AuxVarType::endoLag || aux_var.type == AuxVarType::exoLag)
|
||||
&& aux_var.orig_symb_id == orig_symb_id && aux_var.orig_lead_lag == orig_lead_lag)
|
||||
return aux_var.symb_id;
|
||||
throw SearchFailedException(orig_symb_id, orig_lead_lag);
|
||||
throw SearchFailedException{orig_symb_id, orig_lead_lag};
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -690,9 +690,9 @@ SymbolTable::getOrigSymbIdForAuxVar(int aux_var_symb_id_arg) const noexcept(fals
|
|||
if (optional<int> r = aux_var.orig_symb_id; r)
|
||||
return *r;
|
||||
else
|
||||
throw UnknownSymbolIDException(aux_var_symb_id_arg); // Some diff and unaryOp auxvars have orig_symb_id unset
|
||||
throw UnknownSymbolIDException{aux_var_symb_id_arg}; // Some diff and unaryOp auxvars have orig_symb_id unset
|
||||
}
|
||||
throw UnknownSymbolIDException(aux_var_symb_id_arg);
|
||||
throw UnknownSymbolIDException{aux_var_symb_id_arg};
|
||||
}
|
||||
|
||||
pair<int, int>
|
||||
|
|
|
@ -419,7 +419,7 @@ inline void
|
|||
SymbolTable::validateSymbID(int symb_id) const noexcept(false)
|
||||
{
|
||||
if (symb_id < 0 || symb_id > static_cast<int>(symbol_table.size()))
|
||||
throw UnknownSymbolIDException(symb_id);
|
||||
throw UnknownSymbolIDException{symb_id};
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -469,7 +469,7 @@ SymbolTable::getID(const string &name) const noexcept(false)
|
|||
iter != symbol_table.end())
|
||||
return iter->second;
|
||||
else
|
||||
throw UnknownSymbolNameException(name);
|
||||
throw UnknownSymbolNameException{name};
|
||||
}
|
||||
|
||||
inline int
|
||||
|
@ -484,7 +484,7 @@ SymbolTable::getTypeSpecificID(int id) const noexcept(false)
|
|||
it != type_specific_ids.end())
|
||||
return it->second;
|
||||
else
|
||||
throw NoTypeSpecificIDException(id);
|
||||
throw NoTypeSpecificIDException{id};
|
||||
}
|
||||
|
||||
inline int
|
||||
|
@ -547,7 +547,7 @@ SymbolTable::getAuxVarInfo(int symb_id) const
|
|||
for (const auto &aux_var : aux_vars)
|
||||
if (aux_var.symb_id == symb_id)
|
||||
return aux_var;
|
||||
throw UnknownSymbolIDException(symb_id);
|
||||
throw UnknownSymbolIDException{symb_id};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue