Replace more typedefs by using

Those were not automatically replaced by clang-tidy, I don’t know why…
issue#70
Sébastien Villemot 2018-06-04 14:31:26 +02:00
parent 182c53273e
commit 7d9cd718fc
19 changed files with 76 additions and 76 deletions

View File

@ -1677,7 +1677,7 @@ public:
};
#ifdef BYTE_CODE
typedef vector<pair<Tags, void * >> tags_liste_t;
using tags_liste_t = vector<pair<Tags, void * >>;
class CodeLoad
{
private:

View File

@ -175,13 +175,13 @@ public:
class VarRestrictionsStatement : public Statement
{
private:
typedef pair<pair<int, pair<int, int>>, expr_t> var_restriction_eq_crosseq_t;
using var_restriction_eq_crosseq_t = pair<pair<int, pair<int, int>>, expr_t>;
const string &var_model_name;
const map<string, vector<string>> &var_map;
const map<int, map<int, SymbolList>> exclusion_restrictions;
typedef map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>> equation_restrictions_t;
using equation_restrictions_t = map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>>;
const equation_restrictions_t equation_restrictions;
typedef vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>> crossequation_restrictions_t;
using crossequation_restrictions_t = vector<pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>>;
const crossequation_restrictions_t crossequation_restrictions;
const map<pair<int, int>, double> covariance_number_restriction;
const map<pair<int, int>, pair<int, int>> covariance_pair_restriction;
@ -347,7 +347,7 @@ public:
class ObservationTrendsStatement : public Statement
{
public:
typedef map<string, expr_t> trend_elements_t;
using trend_elements_t = map<string, expr_t>;
private:
const trend_elements_t trend_elements;
const SymbolTable &symbol_table;
@ -437,7 +437,7 @@ public:
class ModelComparisonStatement : public Statement
{
public:
typedef vector<pair<string, string>> filename_list_t;
using filename_list_t = vector<pair<string, string>>;
private:
filename_list_t filename_list;
OptionsList options_list;
@ -518,8 +518,8 @@ public:
class OptimWeightsStatement : public Statement
{
public:
typedef map<string, expr_t> var_weights_t;
typedef map<pair<string, string>, expr_t> covar_weights_t;
using var_weights_t = map<string, expr_t>;
using covar_weights_t = map<pair<string, string>, expr_t>;
private:
const var_weights_t var_weights;
const covar_weights_t covar_weights;
@ -820,7 +820,7 @@ public:
class SvarIdentificationStatement : public Statement
{
public:
// typedef map<pair<int, int>, vector<int>> svar_identification_exclusion_t;
// using svar_identification_exclusion_t = map<pair<int, int>, vector<int>>;
struct svar_identification_restriction
{
int equation;
@ -906,7 +906,7 @@ class SubsamplesStatement : public Statement
{
public:
//! Storage for declaring subsamples: map<subsample_name, <date1, date2 >
typedef map<string, pair<string, string>> subsample_declaration_map_t;
using subsample_declaration_map_t = map<string, pair<string, string>>;
private:
const string name1;
const string name2;

View File

@ -27,7 +27,7 @@
using namespace std;
typedef map<string, double> member_nodes_t;
using member_nodes_t = map<string, double>;
class Hook
{

View File

@ -59,39 +59,39 @@ protected:
//! A reference to the external functions table
ExternalFunctionsTable &external_functions_table;
typedef map<int, NumConstNode *> num_const_node_map_t;
using num_const_node_map_t = map<int, NumConstNode *>;
num_const_node_map_t num_const_node_map;
//! Pair (symbol_id, lag) used as key
typedef map<pair<int, int>, VariableNode *> variable_node_map_t;
using variable_node_map_t = map<pair<int, int>, VariableNode *>;
variable_node_map_t variable_node_map;
//! Pair( Pair(arg1, UnaryOpCode), Pair( Expectation Info Set, Pair(param1_symb_id, param2_symb_id)) ))
typedef map<pair<pair<expr_t, UnaryOpcode>, pair<pair<int, pair<int, int>>, pair<string, vector<int>>>>, UnaryOpNode *> unary_op_node_map_t;
using unary_op_node_map_t = map<pair<pair<expr_t, UnaryOpcode>, pair<pair<int, pair<int, int>>, pair<string, vector<int>>>>, UnaryOpNode *>;
unary_op_node_map_t unary_op_node_map;
//! Pair( Pair( Pair(arg1, arg2), order of Power Derivative), opCode)
typedef map<pair<pair<pair<expr_t, expr_t>, int>, BinaryOpcode>, BinaryOpNode *> binary_op_node_map_t;
using binary_op_node_map_t = map<pair<pair<pair<expr_t, expr_t>, int>, BinaryOpcode>, BinaryOpNode *>;
binary_op_node_map_t binary_op_node_map;
typedef map<pair<pair<pair<expr_t, expr_t>, expr_t>, TrinaryOpcode>, TrinaryOpNode *> trinary_op_node_map_t;
using trinary_op_node_map_t = map<pair<pair<pair<expr_t, expr_t>, expr_t>, TrinaryOpcode>, TrinaryOpNode *>;
trinary_op_node_map_t trinary_op_node_map;
// (arguments, symb_id) -> ExternalFunctionNode
typedef map<pair<vector<expr_t>, int>, ExternalFunctionNode *> external_function_node_map_t;
using external_function_node_map_t = map<pair<vector<expr_t>, int>, ExternalFunctionNode *>;
external_function_node_map_t external_function_node_map;
// (model_name, (symb_id, forecast_horizon)) -> VarExpectationNode
typedef map<pair<string, pair<int, int>>, VarExpectationNode *> var_expectation_node_map_t;
using var_expectation_node_map_t = map<pair<string, pair<int, int>>, VarExpectationNode *>;
var_expectation_node_map_t var_expectation_node_map;
// model_name -> PacExpectationNode
typedef map<string, PacExpectationNode *> pac_expectation_node_map_t;
using pac_expectation_node_map_t = map<string, PacExpectationNode *>;
pac_expectation_node_map_t pac_expectation_node_map;
// ((arguments, deriv_idx), symb_id) -> FirstDerivExternalFunctionNode
typedef map<pair<pair<vector<expr_t>, int>, int>, FirstDerivExternalFunctionNode *> first_deriv_external_function_node_map_t;
using first_deriv_external_function_node_map_t = map<pair<pair<vector<expr_t>, int>, int>, FirstDerivExternalFunctionNode *>;
first_deriv_external_function_node_map_t first_deriv_external_function_node_map;
// ((arguments, (deriv_idx1, deriv_idx2)), symb_id) -> SecondDerivExternalFunctionNode
typedef map<pair<pair<vector<expr_t>, pair<int, int>>, int>, SecondDerivExternalFunctionNode *> second_deriv_external_function_node_map_t;
using second_deriv_external_function_node_map_t = map<pair<pair<vector<expr_t>, pair<int, int>>, int>, SecondDerivExternalFunctionNode *>;
second_deriv_external_function_node_map_t second_deriv_external_function_node_map;
//! Stores local variables value (maps symbol ID to corresponding node)

View File

@ -3366,7 +3366,7 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
output << modstruct << "n_diag = " << nb_diag << ";" << endl;
KF_index_file.write(reinterpret_cast<char *>(&nb_diag), sizeof(nb_diag));
typedef pair<int, pair<int, int >> index_KF;
using index_KF = pair<int, pair<int, int >>;
vector<index_KF> v_index_KF;
for (int i = 0; i < n; i++)
//int i = 0;

View File

@ -42,7 +42,7 @@ private:
//! Stores the equation tags of equations declared as [static]
vector<vector<pair<string, string>>> static_only_equations_equation_tags;
typedef map<pair<int, int>, int> deriv_id_table_t;
using deriv_id_table_t = map<pair<int, int>, int>;
//! Maps a pair (symbol_id, lag) to a deriv ID
deriv_id_table_t deriv_id_table;
//! Maps a deriv ID to a pair (symbol_id, lag)
@ -92,7 +92,7 @@ private:
vector<temporary_terms_inuse_t> v_temporary_terms_inuse;
//! Store the derivatives or the chainrule derivatives:map<pair< equation, pair< variable, lead_lag >, expr_t>
typedef map< pair< int, pair< int, int>>, expr_t> first_chain_rule_derivatives_t;
using first_chain_rule_derivatives_t = map< pair< int, pair< int, int>>, expr_t>;
first_chain_rule_derivatives_t first_chain_rule_derivatives;
//! Writes dynamic model file (Matlab version)
@ -196,13 +196,13 @@ private:
vector<bool> blocks_linear;
//! Map the derivatives for a block pair<lag, make_pair(make_pair(eq, var)), expr_t>
typedef map<pair< int, pair<int, int>>, expr_t> derivative_t;
using derivative_t = map<pair< int, pair<int, int>>, expr_t>;
//! Vector of derivative for each blocks
vector<derivative_t> derivative_endo, derivative_other_endo, derivative_exo, derivative_exo_det;
//!List for each block and for each lag-lead all the other endogenous variables and exogenous variables
using var_t = set<int>;
typedef map<int, var_t> lag_var_t;
using lag_var_t = map<int, var_t>;
vector<lag_var_t> other_endo_block, exo_block, exo_det_block;
//!List for each block the exogenous variables

View File

@ -32,7 +32,7 @@ using namespace std;
ParsingDriver &driver)
// Shortcut to access tokens defined by Bison
typedef Dynare::parser::token token;
using token = Dynare::parser::token;
/* By default yylex returns int, we use token_type.
Unfortunately yyterminate by default returns 0, which is

View File

@ -46,25 +46,25 @@ struct ExprNodeLess;
//! Type for set of temporary terms
/*! The ExprNodeLess ordering is important for the temporary terms algorithm,
see the definition of ExprNodeLess */
typedef set<expr_t, ExprNodeLess> temporary_terms_t;
using temporary_terms_t = set<expr_t, ExprNodeLess>;
/*! Keeps track of array indices of temporary_terms for writing */
typedef map<expr_t, int> temporary_terms_idxs_t;
using temporary_terms_idxs_t = map<expr_t, int>;
//! set of temporary terms used in a block
using temporary_terms_inuse_t = set<int>;
typedef map<int, int> map_idx_t;
using map_idx_t = map<int, int>;
//! Type for evaluation contexts
/*! The key is a symbol id. Lags are assumed to be null */
typedef map<int, double> eval_context_t;
using eval_context_t = map<int, double>;
//! Type for tracking first/second derivative functions that have already been written as temporary terms
typedef map<pair<int, vector<expr_t>>, int> deriv_node_temp_terms_t;
using deriv_node_temp_terms_t = map<pair<int, vector<expr_t>>, int>;
//! Type for the substitution map used in the process of substitutitng diff expressions
//! diff_table[static_expr_t][lag] -> [dynamic_expr_t]
typedef map<expr_t, map<int, expr_t>> diff_table_t;
using diff_table_t = map<expr_t, map<int, expr_t>>;
//! Possible types of output when writing ExprNode(s)
enum ExprNodeOutputType
@ -388,10 +388,10 @@ class ExprNode
virtual expr_t decreaseLeadsLags(int n) const = 0;
//! Type for the substitution map used in the process of creating auxiliary vars for leads >= 2
typedef map<const ExprNode *, const VariableNode *> subst_table_t;
using subst_table_t = map<const ExprNode *, const VariableNode *>;
//! Type for the substitution map used in the process of substituting adl expressions
typedef map<const ExprNode *, const expr_t> subst_table_adl_t;
using subst_table_adl_t = map<const ExprNode *, const expr_t>;
//! Creates auxiliary endo lead variables corresponding to this expression
/*!

View File

@ -58,7 +58,7 @@ public:
{
int nargs, firstDerivSymbID, secondDerivSymbID;
};
typedef map<int, external_function_options> external_function_table_type;
using external_function_table_type = map<int, external_function_options>;
private:
//! Map containing options provided to external_functions()
external_function_table_type externalFunctionTable;

View File

@ -29,13 +29,13 @@ using namespace boost;
namespace MFS
{
typedef property<vertex_index_t, int,
property<vertex_index1_t, int,
property<vertex_degree_t, int,
property<vertex_in_degree_t, int,
property<vertex_out_degree_t, int >>>>> VertexProperty_t;
typedef adjacency_list<listS, listS, bidirectionalS, VertexProperty_t> AdjacencyList_t;
typedef map<graph_traits<AdjacencyList_t>::vertex_descriptor, default_color_type> color_t;
using VertexProperty_t = property<vertex_index_t, int,
property<vertex_index1_t, int,
property<vertex_degree_t, int,
property<vertex_in_degree_t, int,
property<vertex_out_degree_t, int >>>>>;
using AdjacencyList_t = adjacency_list<listS, listS, bidirectionalS, VertexProperty_t>;
using color_t = map<graph_traits<AdjacencyList_t>::vertex_descriptor, default_color_type>;
using vector_vertex_descriptor_t = vector<AdjacencyList_t::vertex_descriptor>;
//! Eliminate a vertex i

View File

@ -40,7 +40,7 @@ ModelTree::computeNormalization(const jacob_map_t &contemporaneous_jacobian, boo
assert(n == symbol_table.endo_nbr());
typedef adjacency_list<vecS, vecS, undirectedS> BipartiteGraph;
using BipartiteGraph = adjacency_list<vecS, vecS, undirectedS>;
/*
Vertices 0 to n-1 are for endogenous (using type specific ID)
@ -579,7 +579,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
blocks = vector<pair<int, int>>(num, make_pair(0, 0));
// Create directed acyclic graph associated to the strongly connected components
typedef adjacency_list<vecS, vecS, directedS> DirectedGraph;
using DirectedGraph = adjacency_list<vecS, vecS, directedS>;
DirectedGraph dag(num);
for (unsigned int i = 0; i < num_vertices(G2); i++)

View File

@ -32,16 +32,16 @@ using namespace std;
#include "ExtendedPreprocessorTypes.hh"
//! Vector describing equations: BlockSimulationType, if BlockSimulationType == EVALUATE_s then a expr_t on the new normalized equation
typedef vector<pair<EquationType, expr_t >> equation_type_and_normalized_equation_t;
using equation_type_and_normalized_equation_t = vector<pair<EquationType, expr_t >>;
//! Vector describing variables: max_lag in the block, max_lead in the block
typedef vector<pair< int, int>> lag_lead_vector_t;
using lag_lead_vector_t = vector<pair< int, int>>;
//! for each block contains pair< pair<Simulation_Type, first_equation>, pair < Block_Size, Recursive_part_Size >>
typedef vector<pair< pair< BlockSimulationType, int>, pair<int, int>>> block_type_firstequation_size_mfs_t;
using block_type_firstequation_size_mfs_t = vector<pair< pair< BlockSimulationType, int>, pair<int, int>>>;
//! for a block contains derivatives pair< pair<block_equation_number, block_variable_number> , pair<lead_lag, expr_t>>
typedef vector< pair<pair<int, int>, pair< int, expr_t >>> block_derivatives_equation_variable_laglead_nodeid_t;
using block_derivatives_equation_variable_laglead_nodeid_t = vector< pair<pair<int, int>, pair< int, expr_t >>>;
//! for all blocks derivatives description
using blocks_derivatives_t = vector<block_derivatives_equation_variable_laglead_nodeid_t>;
@ -73,7 +73,7 @@ protected:
//! Number of non-zero derivatives
int NNZDerivatives[3];
typedef map<pair<int, int>, expr_t> first_derivatives_t;
using first_derivatives_t = map<pair<int, int>, expr_t>;
//! First order derivatives
/*! First index is equation number, second is variable w.r. to which is computed the derivative.
Only non-null derivatives are stored in the map.
@ -81,7 +81,7 @@ protected:
*/
first_derivatives_t first_derivatives;
typedef map<pair<int, pair<int, int>>, expr_t> second_derivatives_t;
using second_derivatives_t = map<pair<int, pair<int, int>>, expr_t>;
//! Second order derivatives
/*! First index is equation number, second and third are variables w.r. to which is computed the derivative.
Only non-null derivatives are stored in the map.
@ -90,7 +90,7 @@ protected:
*/
second_derivatives_t second_derivatives;
typedef map<pair<int, pair<int, pair<int, int>>>, expr_t> third_derivatives_t;
using third_derivatives_t = map<pair<int, pair<int, pair<int, int>>>, expr_t>;
//! Third order derivatives
/*! First index is equation number, second, third and fourth are variables w.r. to which is computed the derivative.
Only non-null derivatives are stored in the map.
@ -158,7 +158,7 @@ protected:
map<int, expr_t> trend_symbols_map;
//! for all trends; the boolean is true if this is a log-trend, false otherwise
typedef map<int, pair<bool, expr_t>> nonstationary_symbols_map_t;
using nonstationary_symbols_map_t = map<int, pair<bool, expr_t>>;
//! Nonstationary variables and their deflators
nonstationary_symbols_map_t nonstationary_symbols_map;
@ -217,11 +217,11 @@ protected:
//! Sparse matrix of double to store the values of the Jacobian
/*! First index is equation number, second index is endogenous type specific ID */
typedef map<pair<int, int>, double> jacob_map_t;
using jacob_map_t = map<pair<int, int>, double>;
//! Sparse matrix of double to store the values of the Jacobian
/*! First index is lag, second index is equation number, third index is endogenous type specific ID */
typedef map<pair<int, pair<int, int>>, expr_t> dynamic_jacob_map_t;
using dynamic_jacob_map_t = map<pair<int, pair<int, int>>, expr_t>;
//! Normalization of equations
/*! Maps endogenous type specific IDs to equation numbers */

View File

@ -55,7 +55,7 @@ public:
We use a vector instead of a map, since the order of declaration matters:
an initialization can depend on a previously initialized variable inside the block
*/
typedef vector<pair<int, expr_t>> init_values_t;
using init_values_t = vector<pair<int, expr_t>>;
protected:
const init_values_t init_values;
const SymbolTable &symbol_table;
@ -106,8 +106,8 @@ public:
a given initialization value in a second initialization inside the block.
Maps pairs (symbol_id, lag) to expr_t
*/
typedef map<pair<int, int>, expr_t> hist_values_t;
typedef map<int, int> hist_vals_wrong_lag_t;
using hist_values_t = map<pair<int, int>, expr_t>;
using hist_vals_wrong_lag_t = map<int, int>;
private:
const hist_values_t hist_values;
const hist_vals_wrong_lag_t hist_vals_wrong_lag;
@ -149,7 +149,7 @@ class HomotopyStatement : public Statement
public:
//! Stores the declarations of homotopy_setup
/*! Order matter so we use a vector. First expr_t can be NULL if no initial value given. */
typedef vector<pair<int, pair<expr_t, expr_t>>> homotopy_values_t;
using homotopy_values_t = vector<pair<int, pair<expr_t, expr_t>>>;
private:
const homotopy_values_t homotopy_values;
const SymbolTable &symbol_table;

View File

@ -219,7 +219,7 @@ private:
expr_t prior_variance;
SubsamplesStatement::subsample_declaration_map_t subsample_declaration_map;
//! Temporary storage for subsample statement: map<pair<var_name1, var_name2>>, subsample_declaration_map >
typedef map<pair<string, string >, SubsamplesStatement::subsample_declaration_map_t > subsample_declarations_t;
using subsample_declarations_t = map<pair<string, string >, SubsamplesStatement::subsample_declaration_map_t >;
subsample_declarations_t subsample_declarations;
//! Temporary storage for shock_groups
vector<string> shock_group;
@ -281,7 +281,7 @@ public:
map<int, map<int, SymbolList>> exclusion_restrictions;
//! > equation and crossequation restrictions
pair<int, pair<int, int>> var_restriction_coeff;
typedef pair<pair<int, pair<int, int>>, expr_t> var_restriction_eq_crosseq_t;
using var_restriction_eq_crosseq_t = pair<pair<int, pair<int, int>>, expr_t>;
vector<var_restriction_eq_crosseq_t> var_restriction_eq_or_crosseq;
pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double> var_restriction_equation_or_crossequation;
map<int, pair<pair<var_restriction_eq_crosseq_t, var_restriction_eq_crosseq_t>, double>> equation_restrictions;

View File

@ -41,7 +41,7 @@ public:
};
//The boolean element indicates if the shock is a surprise (false) or a perfect foresight (true) shock.
//This boolean is used only in case of conditional forecast with extended path method (simulation_type = deterministic).
typedef map<int, vector<DetShockElement>> det_shocks_t;
using det_shocks_t = map<int, vector<DetShockElement>>;
protected:
//! Is this statement a "mshocks" statement ? (instead of a "shocks" statement)
const bool mshocks;
@ -60,8 +60,8 @@ protected:
class ShocksStatement : public AbstractShocksStatement
{
public:
typedef map<int, expr_t> var_and_std_shocks_t;
typedef map<pair<int, int>, expr_t> covar_and_corr_shocks_t;
using var_and_std_shocks_t = map<int, expr_t>;
using covar_and_corr_shocks_t = map<pair<int, int>, expr_t>;
private:
const var_and_std_shocks_t var_shocks, std_shocks;
const covar_and_corr_shocks_t covar_shocks, corr_shocks;

View File

@ -175,13 +175,13 @@ public:
class OptionsList
{
public:
typedef map<string, string> num_options_t;
typedef map<string, pair<string, string>> paired_num_options_t;
typedef map<string, string> string_options_t;
typedef map<string, string> date_options_t;
typedef map<string, SymbolList> symbol_list_options_t;
typedef map<string, vector<int>> vec_int_options_t;
typedef map<string, vector<string >> vec_str_options_t;
using num_options_t = map<string, string>;
using paired_num_options_t = map<string, pair<string, string>>;
using string_options_t = map<string, string>;
using date_options_t = map<string, string>;
using symbol_list_options_t = map<string, SymbolList>;
using vec_int_options_t = map<string, vector<int>>;
using vec_str_options_t = map<string, vector<string >>;
num_options_t num_options;
paired_num_options_t paired_num_options;
string_options_t string_options;

View File

@ -38,7 +38,7 @@ private:
vector<temporary_terms_inuse_t> v_temporary_terms_inuse;
typedef map< pair< int, pair< int, int>>, expr_t> first_chain_rule_derivatives_t;
using first_chain_rule_derivatives_t = map< pair< int, pair< int, int>>, expr_t>;
first_chain_rule_derivatives_t first_chain_rule_derivatives;
//! Writes static model file (standard Matlab version)
@ -124,13 +124,13 @@ protected:
vector<bool> blocks_linear;
//! Map the derivatives for a block pair<lag, make_pair(make_pair(eq, var)), expr_t>
typedef map<pair< int, pair<int, int>>, expr_t> derivative_t;
using derivative_t = map<pair< int, pair<int, int>>, expr_t>;
//! Vector of derivative for each blocks
vector<derivative_t> derivative_endo, derivative_other_endo, derivative_exo, derivative_exo_det;
//!List for each block and for each lag-leag all the other endogenous variables and exogenous variables
using var_t = set<int>;
typedef map<int, var_t> lag_var_t;
using lag_var_t = map<int, var_t>;
vector<lag_var_t> other_endo_block, exo_block, exo_det_block;
//! for each block described the number of static, forward, backward and mixed variables in the block

View File

@ -116,7 +116,7 @@ private:
//! Has method freeze() been called?
bool frozen{false};
typedef map<string, int> symbol_table_type;
using symbol_table_type = map<string, int>;
//! Maps strings to symbol IDs
symbol_table_type symbol_table;

View File

@ -35,7 +35,7 @@ using namespace std;
MacroDriver &driver)
// Shortcut to access tokens defined by Bison
typedef Macro::parser::token token;
using token = Macro::parser::token;
/* By default yylex returns int, we use token_type.
Unfortunately yyterminate by default returns 0, which is