diff --git a/dynare++/kord/approximation.hh b/dynare++/kord/approximation.hh index 561430182..2df864155 100644 --- a/dynare++/kord/approximation.hh +++ b/dynare++/kord/approximation.hh @@ -70,8 +70,8 @@ class ZAuxContainer : public StackContainer, public FoldedStackContainer { public: - typedef StackContainer::_Ctype _Ctype; - typedef StackContainer::itype itype; + using _Ctype = StackContainer::_Ctype; + using itype = StackContainer::itype; ZAuxContainer(const _Ctype *gss, int ngss, int ng, int ny, int nu); itype getType(int i, const Symmetry &s) const override; }; diff --git a/dynare++/kord/decision_rule.hh b/dynare++/kord/decision_rule.hh index 77f573722..a7259dc08 100644 --- a/dynare++/kord/decision_rule.hh +++ b/dynare++/kord/decision_rule.hh @@ -97,7 +97,7 @@ template class DecisionRuleImpl : public ctraits::Tpol, public DecisionRule { protected: - typedef typename ctraits::Tpol _Tparent; + using _Tparent = typename ctraits::Tpol; const Vector ysteady; const PartitionY ypart; const int nu; @@ -482,7 +482,7 @@ public: template class DRFixPoint : public ctraits::Tpol { - typedef typename ctraits::Tpol _Tparent; + using _Tparent = typename ctraits::Tpol; static int max_iter; static int max_newton_iter; static int newton_pause; @@ -492,7 +492,7 @@ class DRFixPoint : public ctraits::Tpol _Tparent *bigf; _Tparent *bigfder; public: - typedef typename DecisionRule::emethod emethod; + using emethod = typename DecisionRule::emethod; DRFixPoint(const _Tg &g, const PartitionY &yp, const Vector &ys, double sigma); diff --git a/dynare++/kord/journal.hh b/dynare++/kord/journal.hh index 6e99054fb..380da538a 100644 --- a/dynare++/kord/journal.hh +++ b/dynare++/kord/journal.hh @@ -96,7 +96,7 @@ public: char prefix[MAXLEN]; char mes[MAXLEN]; SystemResourcesFlash flash; - typedef JournalRecord & (*_Tfunc)(JournalRecord &); + using _Tfunc = JournalRecord &(*)(JournalRecord &); JournalRecord(Journal &jr, char rc = 'M') : recChar(rc), ord(jr.getOrd()), journal(jr) diff --git a/dynare++/kord/korder.hh b/dynare++/kord/korder.hh index 526277e25..efbba9041 100644 --- a/dynare++/kord/korder.hh +++ b/dynare++/kord/korder.hh @@ -72,13 +72,13 @@ class UnfoldedGXContainer; template struct IF { - typedef Then RET; + using RET = Then; }; template struct IF { - typedef Else RET; + using RET = Else; }; template @@ -86,18 +86,18 @@ class ctraits { public: enum { fold, unfold }; - typedef TYPENAME IF::RET Ttensor; - typedef TYPENAME IF::RET Ttensym; - typedef TYPENAME IF::RET Tg; - typedef TYPENAME IF::RET Tgs; - typedef TYPENAME IF::RET Tgss; - typedef TYPENAME IF::RET TG; - typedef TYPENAME IF::RET TZstack; - typedef TYPENAME IF::RET TGstack; - typedef TYPENAME IF::RET Tm; - typedef TYPENAME IF::RET Tpol; - typedef TYPENAME IF::RET TZXstack; - typedef TYPENAME IF::RET TGXstack; + using Ttensor = TYPENAME IF::RET; + using Ttensym = TYPENAME IF::RET; + using Tg = TYPENAME IF::RET; + using Tgs = TYPENAME IF::RET; + using Tgss = TYPENAME IF::RET; + using TG = TYPENAME IF::RET; + using TZstack = TYPENAME IF::RET; + using TGstack = TYPENAME IF::RET; + using Tm = TYPENAME IF::RET; + using Tpol = TYPENAME IF::RET; + using TZXstack = TYPENAME IF::RET; + using TGXstack = TYPENAME IF::RET; }; /* The |PartitionY| class defines the partitioning of state variables diff --git a/dynare++/kord/korder_stoch.hh b/dynare++/kord/korder_stoch.hh index d072d4454..56ac74cea 100644 --- a/dynare++/kord/korder_stoch.hh +++ b/dynare++/kord/korder_stoch.hh @@ -247,9 +247,9 @@ template class GXContainer : public GContainer<_Ttype> { public: - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename StackContainer<_Ttype>::_Ctype _Ctype; - typedef typename StackContainer<_Ttype>::itype itype; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename StackContainer<_Ttype>::_Ctype; + using itype = typename StackContainer<_Ttype>::itype; GXContainer(const _Ctype *gs, int ngs, int nu) : GContainer<_Ttype>(gs, ngs, nu) { @@ -291,9 +291,9 @@ template class ZXContainer : public ZContainer<_Ttype> { public: - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename StackContainer<_Ttype>::_Ctype _Ctype; - typedef typename StackContainer<_Ttype>::itype itype; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename StackContainer<_Ttype>::_Ctype; + using itype = typename StackContainer<_Ttype>::itype; ZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : ZContainer<_Ttype>(gss, ngss, g, ng, ny, nu) { @@ -335,7 +335,7 @@ ZXContainer<_Ttype>::getType(int i, const Symmetry &s) const class UnfoldedGXContainer : public GXContainer, public UnfoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; UnfoldedGXContainer(const _Ctype *gs, int ngs, int nu) : GXContainer(gs, ngs, nu) { @@ -345,7 +345,7 @@ public: class FoldedGXContainer : public GXContainer, public FoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; FoldedGXContainer(const _Ctype *gs, int ngs, int nu) : GXContainer(gs, ngs, nu) { @@ -355,7 +355,7 @@ public: class UnfoldedZXContainer : public ZXContainer, public UnfoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; UnfoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : ZXContainer(gss, ngss, g, ng, ny, nu) { @@ -365,7 +365,7 @@ public: class FoldedZXContainer : public ZXContainer, public FoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; FoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : ZXContainer(gss, ngss, g, ng, ny, nu) { diff --git a/dynare++/kord/mersenne_twister.hh b/dynare++/kord/mersenne_twister.hh index b442786e1..b8f643735 100644 --- a/dynare++/kord/mersenne_twister.hh +++ b/dynare++/kord/mersenne_twister.hh @@ -16,7 +16,7 @@ class MersenneTwister : public RandomGenerator { protected: - typedef unsigned int uint32; + using uint32 = unsigned int; enum {STATE_SIZE = 624}; enum {RECUR_OFFSET = 397}; uint32 statevec[STATE_SIZE]; diff --git a/dynare++/parser/cc/atom_assignings.hh b/dynare++/parser/cc/atom_assignings.hh index e3e660f5c..b27da9f91 100644 --- a/dynare++/parser/cc/atom_assignings.hh +++ b/dynare++/parser/cc/atom_assignings.hh @@ -26,7 +26,7 @@ namespace ogp { friend class AtomAsgnEvaluator; protected: - typedef std::map Tvarintmap; + using Tvarintmap = std::map; /** All atoms which should be sufficient for formulas at the * right hand sides. The atoms should be filled with names * (preregistered). This is a responsibility of the caller. */ @@ -88,7 +88,7 @@ namespace ogp public std::vector { protected: - typedef std::map Tusrvalmap; + using Tusrvalmap = std::map; Tusrvalmap user_values; const AtomAssignings &aa; public: diff --git a/dynare++/parser/cc/atom_substitutions.hh b/dynare++/parser/cc/atom_substitutions.hh index ee8c831e9..8e2e1f172 100644 --- a/dynare++/parser/cc/atom_substitutions.hh +++ b/dynare++/parser/cc/atom_substitutions.hh @@ -31,10 +31,10 @@ namespace ogp class AtomSubstitutions { public: - typedef pair Tshiftname; - typedef map Tshiftmap; - typedef set Tshiftnameset; - typedef map Toldnamemap; + using Tshiftname = pair; + using Tshiftmap = map; + using Tshiftnameset = set; + using Toldnamemap = map; protected: /** This maps a new name to a shifted old name. This is, one * entry looks as "a_m3 ==> a(-3)", saying that a variable diff --git a/dynare++/parser/cc/dynamic_atoms.hh b/dynare++/parser/cc/dynamic_atoms.hh index 829d3f3d2..e5e6e1d1b 100644 --- a/dynare++/parser/cc/dynamic_atoms.hh +++ b/dynare++/parser/cc/dynamic_atoms.hh @@ -74,8 +74,8 @@ namespace ogp { public: /** Type for a map mapping tree indices to double values. */ - typedef map Tconstantmap; - typedef map Tintintmap; + using Tconstantmap = map; + using Tintintmap = map; protected: /** Map mapping a tree index of a constant to its double value. */ Tconstantmap cmap; @@ -124,7 +124,7 @@ namespace ogp } private: /** Inverse map to Tconstantmap. */ - typedef map Tconstantinvmap; + using Tconstantinvmap = map; /** This is an inverse map to cmap. This is only used for fast * queries for the existing double constants in check * method and add_constant. */ @@ -140,12 +140,12 @@ namespace ogp { public: /** Definition of a type mapping lags to the indices of the variables. */ - typedef map Tlagmap; + using Tlagmap = map; protected: /** Definition of a type mapping names of the atoms to Tlagmap. */ - typedef map Tvarmap; + using Tvarmap = map; /** Definition of a type mapping indices of variables to the variable names. */ - typedef map Tindexmap; + using Tindexmap = map; /** This is just a storage for variable names, since all other * instances of a variable name just point to the memory * allocated by this object. */ diff --git a/dynare++/parser/cc/fine_atoms.hh b/dynare++/parser/cc/fine_atoms.hh index dfd213d33..490e74cfc 100644 --- a/dynare++/parser/cc/fine_atoms.hh +++ b/dynare++/parser/cc/fine_atoms.hh @@ -109,7 +109,7 @@ namespace ogp { protected: /** Type for a map mapping a variable name to an integer. */ - typedef map Tvarintmap; + using Tvarintmap = map; /** Reference to atoms. */ const FineAtoms &atoms; /** The vector of all endo and exo variables in outer @@ -175,7 +175,7 @@ namespace ogp { friend class AllvarOuterOrdering; protected: - typedef map Tvarintmap; + using Tvarintmap = map; private: /** The vector of parameters names. The order gives the order * the data is communicated with outside world. */ diff --git a/dynare++/parser/cc/formula_parser.hh b/dynare++/parser/cc/formula_parser.hh index 448473545..c67387bec 100644 --- a/dynare++/parser/cc/formula_parser.hh +++ b/dynare++/parser/cc/formula_parser.hh @@ -89,7 +89,7 @@ namespace ogp /** For retrieving derivatives via a multiindex, we have a map * mapping a multiindex to a derivative in the tder * ordering. This means that indices[ind2der[index]] == index. */ - typedef map Tfmiintmap; + using Tfmiintmap = map; Tfmiintmap ind2der; /** The number of variables. */ int nvar; diff --git a/dynare++/parser/cc/static_atoms.hh b/dynare++/parser/cc/static_atoms.hh index 77b6970e4..993c722fd 100644 --- a/dynare++/parser/cc/static_atoms.hh +++ b/dynare++/parser/cc/static_atoms.hh @@ -13,8 +13,8 @@ namespace ogp class StaticAtoms : public Atoms, public Constants { protected: - typedef map Tvarmap; - typedef map Tinvmap; + using Tvarmap = map; + using Tinvmap = map; /** Storage for names. */ NameStorage varnames; /** Outer order of variables. */ diff --git a/dynare++/parser/cc/static_fine_atoms.hh b/dynare++/parser/cc/static_fine_atoms.hh index 24ddb4859..6913c4c85 100644 --- a/dynare++/parser/cc/static_fine_atoms.hh +++ b/dynare++/parser/cc/static_fine_atoms.hh @@ -22,9 +22,9 @@ namespace ogp class StaticFineAtoms : public StaticAtoms { public: - typedef map Tintintmap; + using Tintintmap = map; protected: - typedef map Tvarintmap; + using Tvarintmap = map; private: /** The vector of parameter names, gives the parameter * ordering. */ diff --git a/dynare++/parser/cc/tree.hh b/dynare++/parser/cc/tree.hh index 409a4ec37..dde4da4ef 100644 --- a/dynare++/parser/cc/tree.hh +++ b/dynare++/parser/cc/tree.hh @@ -181,22 +181,22 @@ namespace ogp /** This defines a type for a map mapping the unary and binary * operations to their indices. */ - typedef unordered_map _Topmap; - typedef _Topmap::value_type _Topval; + using _Topmap = unordered_map; + using _Topval = _Topmap::value_type; /** This is the map mapping the unary and binary operations to * the indices of the terms.*/ _Topmap opmap; /** This is a type for a set of integers. */ - typedef unordered_set _Tintset; + using _Tintset = unordered_set; /** This is a vector of integer sets corresponding to the * nulary terms contained in the term. */ vector<_Tintset> nul_incidence; /** This is a type of the map from variables (nulary terms) to * the terms. */ - typedef unordered_map _Tderivmap; + using _Tderivmap = unordered_map; /** This is a vector of derivative mappings. For each term, it * maps variables to the derivatives of the term with respect * to the variables. */ diff --git a/dynare++/src/dynare_atoms.hh b/dynare++/src/dynare_atoms.hh index 202590187..09e661689 100644 --- a/dynare++/src/dynare_atoms.hh +++ b/dynare++/src/dynare_atoms.hh @@ -24,7 +24,7 @@ namespace ogdyn /** A definition of a type mapping a string to an integer. Used as * a substitution map, saying what names are substituted for what * expressions represented by tree indices. */ - typedef map Tsubstmap; + using Tsubstmap = map; class DynareStaticAtoms : public ogp::StaticAtoms { @@ -54,7 +54,7 @@ namespace ogdyn public: enum atype {endovar, exovar, param}; protected: - typedef map Tatypemap; + using Tatypemap = map; /** The map assigining a type to each name. */ Tatypemap atom_type; public: diff --git a/dynare++/src/forw_subst_builder.hh b/dynare++/src/forw_subst_builder.hh index ea5775a7e..09c952436 100644 --- a/dynare++/src/forw_subst_builder.hh +++ b/dynare++/src/forw_subst_builder.hh @@ -26,7 +26,7 @@ namespace ogdyn class ForwSubstBuilder { - typedef map Ttermauxmap; + using Ttermauxmap = map; protected: /** Reference to the model, to which we will add equations and * change some equations. */ diff --git a/dynare++/src/planner_builder.hh b/dynare++/src/planner_builder.hh index 85ea5946a..8c9ad19a0 100644 --- a/dynare++/src/planner_builder.hh +++ b/dynare++/src/planner_builder.hh @@ -150,12 +150,12 @@ namespace ogdyn friend class MultInitSS; public: /** Type for a set of variable names. */ - typedef unordered_set Tvarset; + using Tvarset = unordered_set; /** Type for a set of equations. An equation is identified by * an index to an equation in the equation vector given by * DynareModel::eqs. The tree index of the i-th formula is * retrieved as DynareModel::egs.formula(i). */ - typedef vector Teqset; + using Teqset = vector; protected: /** This is a set of variables wrt which the planner * optimizes. These could be all endogenous variables, but it diff --git a/dynare++/sylv/cc/QuasiTriangular.hh b/dynare++/sylv/cc/QuasiTriangular.hh index e6ef3ff5e..efdd4ebef 100644 --- a/dynare++/sylv/cc/QuasiTriangular.hh +++ b/dynare++/sylv/cc/QuasiTriangular.hh @@ -150,7 +150,7 @@ public: template struct _diag_iter { - typedef _diag_iter<_Tdiag, _Tblock, _Titer> _Self; + using _Self = _diag_iter<_Tdiag, _Tblock, _Titer>; _Tdiag diag; _Titer it; public: @@ -197,8 +197,8 @@ public: class Diagonal { public: - typedef _diag_iter::const_iterator> const_diag_iter; - typedef _diag_iter::iterator> diag_iter; + using const_diag_iter = _diag_iter::const_iterator>; + using diag_iter = _diag_iter::iterator>; private: int num_all{0}; list blocks; @@ -281,7 +281,7 @@ private: template struct _matrix_iter { - typedef _matrix_iter<_TRef, _TPtr> _Self; + using _Self = _matrix_iter<_TRef, _TPtr>; int d_size; bool real; _TPtr ptr; @@ -323,8 +323,8 @@ public: template class _column_iter : public _matrix_iter<_TRef, _TPtr> { - typedef _matrix_iter<_TRef, _TPtr> _Tparent; - typedef _column_iter<_TRef, _TPtr> _Self; + using _Tparent = _matrix_iter<_TRef, _TPtr>; + using _Self = _column_iter<_TRef, _TPtr>; int row; public: _column_iter(_TPtr base, int ds, bool r, int rw) @@ -358,8 +358,8 @@ public: template class _row_iter : public _matrix_iter<_TRef, _TPtr> { - typedef _matrix_iter<_TRef, _TPtr> _Tparent; - typedef _row_iter<_TRef, _TPtr> _Self; + using _Tparent = _matrix_iter<_TRef, _TPtr>; + using _Self = _row_iter<_TRef, _TPtr>; int col; public: _row_iter(_TPtr base, int ds, bool r, int cl) @@ -396,12 +396,12 @@ class SchurDecompZero; class QuasiTriangular : public SqSylvMatrix { public: - typedef _column_iter const_col_iter; - typedef _column_iter col_iter; - typedef _row_iter const_row_iter; - typedef _row_iter row_iter; - typedef Diagonal::const_diag_iter const_diag_iter; - typedef Diagonal::diag_iter diag_iter; + using const_col_iter = _column_iter; + using col_iter = _column_iter; + using const_row_iter = _row_iter; + using row_iter = _row_iter; + using const_diag_iter = Diagonal::const_diag_iter; + using diag_iter = Diagonal::diag_iter; protected: Diagonal diagonal; public: diff --git a/dynare++/sylv/cc/SchurDecompEig.hh b/dynare++/sylv/cc/SchurDecompEig.hh index 6b9a7747e..e50dd8504 100644 --- a/dynare++/sylv/cc/SchurDecompEig.hh +++ b/dynare++/sylv/cc/SchurDecompEig.hh @@ -13,7 +13,7 @@ class SchurDecompEig : public SchurDecomp { public: - typedef QuasiTriangular::diag_iter diag_iter; + using diag_iter = QuasiTriangular::diag_iter; SchurDecompEig(const SqSylvMatrix &m) : SchurDecomp(m) { } diff --git a/dynare++/sylv/cc/SimilarityDecomp.hh b/dynare++/sylv/cc/SimilarityDecomp.hh index 6cc275efc..856707594 100644 --- a/dynare++/sylv/cc/SimilarityDecomp.hh +++ b/dynare++/sylv/cc/SimilarityDecomp.hh @@ -14,7 +14,7 @@ class SimilarityDecomp SqSylvMatrix *q; BlockDiagonal *b; SqSylvMatrix *invq; - typedef BlockDiagonal::diag_iter diag_iter; + using diag_iter = BlockDiagonal::diag_iter; public: SimilarityDecomp(const double *d, int d_size, double log10norm = 3.0); virtual diff --git a/dynare++/sylv/cc/SylvParams.hh b/dynare++/sylv/cc/SylvParams.hh index bb34f27ab..2ffb337c4 100644 --- a/dynare++/sylv/cc/SylvParams.hh +++ b/dynare++/sylv/cc/SylvParams.hh @@ -18,7 +18,7 @@ template struct ParamItem { protected: - typedef ParamItem<_Type> _Self; + using _Self = ParamItem<_Type>; status s; _Type value; public: @@ -74,7 +74,7 @@ public: class SylvParams { public: - typedef enum {iter, recurse} solve_method; + using solve_method = enum {iter, recurse}; protected: class DoubleParamItem : public ParamItem diff --git a/dynare++/sylv/cc/TriangularSylvester.hh b/dynare++/sylv/cc/TriangularSylvester.hh index 077f60e7e..61bbd6550 100644 --- a/dynare++/sylv/cc/TriangularSylvester.hh +++ b/dynare++/sylv/cc/TriangularSylvester.hh @@ -76,8 +76,8 @@ private: /* recursivelly calculates kronecker product of complex vectors (used in getEigSep) */ static void multEigVector(KronVector &eig, const Vector &feig, const Vector &keig); /* auxiliary typedefs */ - typedef QuasiTriangular::const_diag_iter const_diag_iter; - typedef QuasiTriangular::const_row_iter const_row_iter; + using const_diag_iter = QuasiTriangular::const_diag_iter; + using const_row_iter = QuasiTriangular::const_row_iter; /* called from solvi */ void solviRealAndEliminate(double r, const_diag_iter di, KronVector &d, double &eig_min) const; diff --git a/dynare++/tl/cc/equivalence.hh b/dynare++/tl/cc/equivalence.hh index 1ed265378..6b9c2e917 100644 --- a/dynare++/tl/cc/equivalence.hh +++ b/dynare++/tl/cc/equivalence.hh @@ -99,8 +99,8 @@ private: int n; list classes; public: - typedef list::const_iterator const_seqit; - typedef list::iterator seqit; + using const_seqit = list::const_iterator; + using seqit = list::iterator; /* The first constructor constructs $\{\{0\},\{1\},\ldots,\{n-1\}\}$. @@ -185,7 +185,7 @@ class EquivalenceSet int n; list equis; public: - typedef list::const_iterator const_iterator; + using const_iterator = list::const_iterator; EquivalenceSet(int num); void print(const char *prefix) const; const_iterator diff --git a/dynare++/tl/cc/fine_container.hh b/dynare++/tl/cc/fine_container.hh index 4bccbc9b3..7ed6a1308 100644 --- a/dynare++/tl/cc/fine_container.hh +++ b/dynare++/tl/cc/fine_container.hh @@ -75,9 +75,9 @@ template class FineContainer : public SizeRefinement, public StackContainer<_Ttype> { protected: - typedef StackContainer<_Ttype> _Stype; - typedef typename StackContainerInterface<_Ttype>::_Ctype _Ctype; - typedef typename StackContainerInterface<_Ttype>::itype itype; + using _Stype = StackContainer<_Ttype>; + using _Ctype = typename StackContainerInterface<_Ttype>::_Ctype; + using itype = typename StackContainerInterface<_Ttype>::itype; _Ctype **const ref_conts; const _Stype &stack_cont; public: diff --git a/dynare++/tl/cc/sparse_tensor.hh b/dynare++/tl/cc/sparse_tensor.hh index b8f1fa2f2..ef703478b 100644 --- a/dynare++/tl/cc/sparse_tensor.hh +++ b/dynare++/tl/cc/sparse_tensor.hh @@ -50,11 +50,11 @@ struct ltseq class SparseTensor { public: - typedef pair Item; - typedef multimap Map; - typedef Map::const_iterator const_iterator; + using Item = pair; + using Map = multimap; + using const_iterator = Map::const_iterator; protected: - typedef Map::iterator iterator; + using iterator = Map::iterator; Map m; const int dim; @@ -128,7 +128,7 @@ public: class FSSparseTensor : public SparseTensor { public: - typedef SparseTensor::const_iterator const_iterator; + using const_iterator = SparseTensor::const_iterator; private: const int nv; const Symmetry sym; @@ -158,7 +158,7 @@ public: class GSSparseTensor : public SparseTensor { public: - typedef SparseTensor::const_iterator const_iterator; + using const_iterator = SparseTensor::const_iterator; private: const TensorDimens tdims; public: diff --git a/dynare++/tl/cc/stack_container.hh b/dynare++/tl/cc/stack_container.hh index 52cb86242..742d40cf5 100644 --- a/dynare++/tl/cc/stack_container.hh +++ b/dynare++/tl/cc/stack_container.hh @@ -92,8 +92,8 @@ template class StackContainerInterface { public: - typedef TensorContainer<_Ttype> _Ctype; - typedef enum { matrix, unit, zero} itype; + using _Ctype = TensorContainer<_Ttype>; + using itype = enum { matrix, unit, zero}; protected: const EquivalenceBundle &ebundle; public: @@ -134,9 +134,9 @@ template class StackContainer : virtual public StackContainerInterface<_Ttype> { public: - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename StackContainerInterface<_Ttype>::_Ctype _Ctype; - typedef typename StackContainerInterface<_Ttype>::itype itype; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename StackContainerInterface<_Ttype>::_Ctype; + using itype = typename StackContainerInterface<_Ttype>::itype; protected: int num_conts; IntSequence stack_sizes; @@ -341,10 +341,10 @@ template class ZContainer : public StackContainer<_Ttype> { public: - typedef StackContainer<_Ttype> _Tparent; - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename _Tparent::_Ctype _Ctype; - typedef typename _Tparent::itype itype; + using _Tparent = StackContainer<_Ttype>; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename _Tparent::_Ctype; + using itype = typename _Tparent::itype; ZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : _Tparent(4, 2) @@ -390,7 +390,7 @@ class FoldedZContainer : public ZContainer, public FoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; FoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : ZContainer(gss, ngss, g, ng, ny, nu) @@ -402,7 +402,7 @@ class UnfoldedZContainer : public ZContainer, public UnfoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; UnfoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) : ZContainer(gss, ngss, g, ng, ny, nu) @@ -424,10 +424,10 @@ template class GContainer : public StackContainer<_Ttype> { public: - typedef StackContainer<_Ttype> _Tparent; - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename StackContainer<_Ttype>::_Ctype _Ctype; - typedef typename StackContainer<_Ttype>::itype itype; + using _Tparent = StackContainer<_Ttype>; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename StackContainer<_Ttype>::_Ctype; + using itype = typename StackContainer<_Ttype>::itype; GContainer(const _Ctype *gs, int ngs, int nu) : StackContainer<_Ttype>(4, 1) { @@ -473,7 +473,7 @@ class FoldedGContainer : public GContainer, public FoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; FoldedGContainer(const _Ctype *gs, int ngs, int nu) : GContainer(gs, ngs, nu) { @@ -484,7 +484,7 @@ class UnfoldedGContainer : public GContainer, public UnfoldedStackContainer { public: - typedef TensorContainer _Ctype; + using _Ctype = TensorContainer; UnfoldedGContainer(const _Ctype *gs, int ngs, int nu) : GContainer(gs, ngs, nu) { @@ -501,9 +501,9 @@ template class StackProduct { public: - typedef StackContainerInterface<_Ttype> _Stype; - typedef typename _Stype::_Ctype _Ctype; - typedef typename _Stype::itype itype; + using _Stype = StackContainerInterface<_Ttype>; + using _Ctype = typename _Stype::_Ctype; + using itype = typename _Stype::itype; protected: const _Stype &stack_cont; InducedSymmetries syms; @@ -611,8 +611,8 @@ template class KronProdStack : public KronProdAllOptim { public: - typedef StackProduct<_Ttype> _Ptype; - typedef StackContainerInterface<_Ttype> _Stype; + using _Ptype = StackProduct<_Ttype>; + using _Stype = StackContainerInterface<_Ttype>; /* Here we construct |KronProdAllOptim| from |StackContainer| and given selections of stack items from stack containers in the product. We diff --git a/dynare++/tl/cc/sthread.hh b/dynare++/tl/cc/sthread.hh index e705c97fd..aab785d30 100644 --- a/dynare++/tl/cc/sthread.hh +++ b/dynare++/tl/cc/sthread.hh @@ -81,29 +81,45 @@ namespace sthread template struct IF { - typedef Then RET; + using RET = Then; }; template struct IF { - typedef Else RET; + using RET = Else; }; enum { posix, empty}; - template - class thread_traits; + + template + class thread; template class detach_thread; + /* Clear. We have only |run|, |detach_run|, |exit| and |join|, since + this is only a simple interface. */ + + template + struct thread_traits + { + using _Tthread = typename IF::RET; + using _Ctype = thread<0>; + using _Dtype = detach_thread<0>; + static void run(_Ctype *c); + static void detach_run(_Dtype *c); + static void exit(); + static void join(_Ctype *c); + }; + /* The class of |thread| is clear. The user implements |operator()()|, the method |run| runs the user's code as joinable thread, |exit| kills the execution. */ template class thread { - typedef thread_traits _Ttraits; - typedef typename _Ttraits::_Tthread _Tthread; + using _Ttraits = thread_traits<0>; + using _Tthread = typename _Ttraits::_Tthread; _Tthread th; public: virtual ~thread() @@ -144,10 +160,10 @@ namespace sthread template class thread_group { - typedef thread_traits _Ttraits; - typedef thread _Ctype; + using _Ttraits = thread_traits; + using _Ctype = thread; list<_Ctype *> tlist; - typedef typename list<_Ctype *>::iterator iterator; + using iterator = typename list<_Ctype *>::iterator; public: static int max_parallel_threads; void @@ -214,30 +230,16 @@ namespace sthread } }; - /* Clear. We have only |run|, |detach_run|, |exit| and |join|, since - this is only a simple interface. */ - - template - struct thread_traits - { - typedef typename IF::RET _Tthread; - typedef thread _Ctype; - typedef detach_thread _Dtype; - static void run(_Ctype *c); - static void detach_run(_Dtype *c); - static void exit(); - static void join(_Ctype *c); - }; /* Clear. We have only |init|, |lock|, and |unlock|. */ struct ltmmkey; - typedef pair mmkey; + using mmkey = pair; template struct mutex_traits { - typedef typename IF::RET _Tmutex; - typedef map, ltmmkey> mutex_int_map; + using _Tmutex = typename IF::RET; + using mutex_int_map = map, ltmmkey>; static void init(_Tmutex &m); static void lock(_Tmutex &m); static void unlock(_Tmutex &m); @@ -274,12 +276,12 @@ namespace sthread class mutex_map : public mutex_traits::mutex_int_map { - typedef typename mutex_traits::_Tmutex _Tmutex; - typedef mutex_traits _Mtraits; - typedef pair<_Tmutex, int> mmval; - typedef map _Tparent; - typedef typename _Tparent::iterator iterator; - typedef typename _Tparent::value_type _mvtype; + using _Tmutex = typename mutex_traits::_Tmutex; + using _Mtraits = mutex_traits; + using mmval = pair<_Tmutex, int>; + using _Tparent = map; + using iterator = typename _Tparent::iterator; + using _mvtype = typename _Tparent::value_type; _Tmutex m; public: mutex_map() @@ -340,10 +342,10 @@ namespace sthread template class synchro { - typedef typename mutex_traits::_Tmutex _Tmutex; - typedef mutex_traits _Mtraits; + using _Tmutex = typename mutex_traits::_Tmutex; + using _Mtraits = mutex_traits<0>; public: - typedef mutex_map mutex_map_t; + using mutex_map_t = mutex_map<0>; private: const void *caller; const char *iden; @@ -404,8 +406,8 @@ namespace sthread template struct cond_traits { - typedef typename IF::RET _Tcond; - typedef typename mutex_traits::_Tmutex _Tmutex; + using _Tcond = typename IF::RET; + using _Tmutex = typename mutex_traits::_Tmutex; static void init(_Tcond &cond); static void broadcast(_Tcond &cond); static void wait(_Tcond &cond, _Tmutex &mutex); @@ -424,8 +426,8 @@ namespace sthread template class condition_counter { - typedef typename mutex_traits::_Tmutex _Tmutex; - typedef typename cond_traits::_Tcond _Tcond; + using _Tmutex = typename mutex_traits::_Tmutex; + using _Tcond = typename cond_traits::_Tcond; int counter{0}; _Tmutex mut; _Tcond cond; @@ -524,11 +526,11 @@ namespace sthread template class detach_thread_group { - typedef thread_traits _Ttraits; - typedef cond_traits _Ctraits; - typedef detach_thread _Ctype; + using _Ttraits = thread_traits; + using _Ctraits = cond_traits; + using _Ctype = detach_thread; list<_Ctype *> tlist; - typedef typename list<_Ctype *>::iterator iterator; + using iterator = typename list<_Ctype *>::iterator; condition_counter counter; public: static int max_parallel_threads; @@ -583,9 +585,9 @@ namespace sthread /* Here we only define the specializations for POSIX threads. Then we define the macros. Note that the |PosixSynchro| class construct itself from the static map defined in {\tt sthreads.cpp}. */ - typedef detach_thread PosixThread; - typedef detach_thread_group PosixThreadGroup; - typedef synchro posix_synchro; + using PosixThread = detach_thread; + using PosixThreadGroup = detach_thread_group; + using posix_synchro = synchro; class PosixSynchro : public posix_synchro { public: @@ -602,9 +604,9 @@ namespace sthread mutex. |NoSynchro| class is also empty, but an empty constructor is declared. The empty destructor is declared only to avoid ``unused variable warning''. */ - typedef thread NoThread; - typedef thread_group NoThreadGroup; - typedef synchro no_synchro; + using NoThread = thread; + using NoThreadGroup = thread_group; + using no_synchro = synchro; class NoSynchro { public: diff --git a/dynare++/tl/cc/t_container.hh b/dynare++/tl/cc/t_container.hh index 2ecfac8e0..0547fb39b 100644 --- a/dynare++/tl/cc/t_container.hh +++ b/dynare++/tl/cc/t_container.hh @@ -94,13 +94,13 @@ template class TensorContainer { protected: - typedef const _Ttype *_const_ptr; - typedef _Ttype *_ptr; - typedef map _Map; - typedef typename _Map::value_type _mvtype; + using _const_ptr = const _Ttype *; + using _ptr = _Ttype *; + using _Map = map; + using _mvtype = typename _Map::value_type; public: - typedef typename _Map::iterator iterator; - typedef typename _Map::const_iterator const_iterator; + using iterator = typename _Map::iterator; + using const_iterator = typename _Map::const_iterator; private: int n; _Map m; diff --git a/dynare++/tl/cc/t_polynomial.hh b/dynare++/tl/cc/t_polynomial.hh index 6d80dca9b..58dd7a57b 100644 --- a/dynare++/tl/cc/t_polynomial.hh +++ b/dynare++/tl/cc/t_polynomial.hh @@ -97,8 +97,8 @@ class TensorPolynomial : public TensorContainer<_Ttype> int nr; int nv; int maxdim; - typedef TensorContainer<_Ttype> _Tparent; - typedef typename _Tparent::_ptr _ptr; + using _Tparent = TensorContainer<_Ttype>; + using _ptr = typename _Tparent::_ptr; public: TensorPolynomial(int rows, int vars) : TensorContainer<_Ttype>(1), diff --git a/dynare++/tl/cc/tensor.hh b/dynare++/tl/cc/tensor.hh index 2a30f569f..2e22f59b1 100644 --- a/dynare++/tl/cc/tensor.hh +++ b/dynare++/tl/cc/tensor.hh @@ -76,7 +76,7 @@ template class _index { - typedef _index<_Tptr> _Self; + using _Self = _index<_Tptr>; _Tptr tensor; int offset; IntSequence coor; @@ -162,7 +162,7 @@ class Tensor : public TwoDMatrix { public: enum indor {along_row, along_col}; - typedef _index index; + using index = _index; protected: const index in_beg; const index in_end;