Port to C++11 using keyword

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

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html
time-shift
Sébastien Villemot 2019-01-09 17:21:14 +01:00
parent 60fd92ddce
commit 922014c2fa
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
30 changed files with 174 additions and 172 deletions

View File

@ -70,8 +70,8 @@
class ZAuxContainer : public StackContainer<FGSTensor>, public FoldedStackContainer class ZAuxContainer : public StackContainer<FGSTensor>, public FoldedStackContainer
{ {
public: public:
typedef StackContainer<FGSTensor>::_Ctype _Ctype; using _Ctype = StackContainer<FGSTensor>::_Ctype;
typedef StackContainer<FGSTensor>::itype itype; using itype = StackContainer<FGSTensor>::itype;
ZAuxContainer(const _Ctype *gss, int ngss, int ng, int ny, int nu); ZAuxContainer(const _Ctype *gss, int ngss, int ng, int ny, int nu);
itype getType(int i, const Symmetry &s) const override; itype getType(int i, const Symmetry &s) const override;
}; };

View File

@ -97,7 +97,7 @@ template <int t>
class DecisionRuleImpl : public ctraits<t>::Tpol, public DecisionRule class DecisionRuleImpl : public ctraits<t>::Tpol, public DecisionRule
{ {
protected: protected:
typedef typename ctraits<t>::Tpol _Tparent; using _Tparent = typename ctraits<t>::Tpol;
const Vector ysteady; const Vector ysteady;
const PartitionY ypart; const PartitionY ypart;
const int nu; const int nu;
@ -482,7 +482,7 @@ public:
template <int t> template <int t>
class DRFixPoint : public ctraits<t>::Tpol class DRFixPoint : public ctraits<t>::Tpol
{ {
typedef typename ctraits<t>::Tpol _Tparent; using _Tparent = typename ctraits<t>::Tpol;
static int max_iter; static int max_iter;
static int max_newton_iter; static int max_newton_iter;
static int newton_pause; static int newton_pause;
@ -492,7 +492,7 @@ class DRFixPoint : public ctraits<t>::Tpol
_Tparent *bigf; _Tparent *bigf;
_Tparent *bigfder; _Tparent *bigfder;
public: public:
typedef typename DecisionRule::emethod emethod; using emethod = typename DecisionRule::emethod;
DRFixPoint(const _Tg &g, const PartitionY &yp, DRFixPoint(const _Tg &g, const PartitionY &yp,
const Vector &ys, double sigma); const Vector &ys, double sigma);

View File

@ -96,7 +96,7 @@ public:
char prefix[MAXLEN]; char prefix[MAXLEN];
char mes[MAXLEN]; char mes[MAXLEN];
SystemResourcesFlash flash; SystemResourcesFlash flash;
typedef JournalRecord & (*_Tfunc)(JournalRecord &); using _Tfunc = JournalRecord &(*)(JournalRecord &);
JournalRecord(Journal &jr, char rc = 'M') JournalRecord(Journal &jr, char rc = 'M')
: recChar(rc), ord(jr.getOrd()), journal(jr) : recChar(rc), ord(jr.getOrd()), journal(jr)

View File

@ -72,13 +72,13 @@ class UnfoldedGXContainer;
template<bool condition, class Then, class Else> template<bool condition, class Then, class Else>
struct IF struct IF
{ {
typedef Then RET; using RET = Then;
}; };
template<class Then, class Else> template<class Then, class Else>
struct IF<false, Then, Else> struct IF<false, Then, Else>
{ {
typedef Else RET; using RET = Else;
}; };
template <int type> template <int type>
@ -86,18 +86,18 @@ class ctraits
{ {
public: public:
enum { fold, unfold }; enum { fold, unfold };
typedef TYPENAME IF<type == fold, FGSTensor, UGSTensor>::RET Ttensor; using Ttensor = TYPENAME IF<type == fold, FGSTensor, UGSTensor>::RET;
typedef TYPENAME IF<type == fold, FFSTensor, UFSTensor>::RET Ttensym; using Ttensym = TYPENAME IF<type == fold, FFSTensor, UFSTensor>::RET;
typedef TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET Tg; using Tg = TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET;
typedef TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET Tgs; using Tgs = TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET;
typedef TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET Tgss; using Tgss = TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET;
typedef TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET TG; using TG = TYPENAME IF<type == fold, FGSContainer, UGSContainer>::RET;
typedef TYPENAME IF<type == fold, FoldedZContainer, UnfoldedZContainer>::RET TZstack; using TZstack = TYPENAME IF<type == fold, FoldedZContainer, UnfoldedZContainer>::RET;
typedef TYPENAME IF<type == fold, FoldedGContainer, UnfoldedGContainer>::RET TGstack; using TGstack = TYPENAME IF<type == fold, FoldedGContainer, UnfoldedGContainer>::RET;
typedef TYPENAME IF<type == fold, FNormalMoments, UNormalMoments>::RET Tm; using Tm = TYPENAME IF<type == fold, FNormalMoments, UNormalMoments>::RET;
typedef TYPENAME IF<type == fold, FTensorPolynomial, UTensorPolynomial>::RET Tpol; using Tpol = TYPENAME IF<type == fold, FTensorPolynomial, UTensorPolynomial>::RET;
typedef TYPENAME IF<type == fold, FoldedZXContainer, UnfoldedZXContainer>::RET TZXstack; using TZXstack = TYPENAME IF<type == fold, FoldedZXContainer, UnfoldedZXContainer>::RET;
typedef TYPENAME IF<type == fold, FoldedGXContainer, UnfoldedGXContainer>::RET TGXstack; using TGXstack = TYPENAME IF<type == fold, FoldedGXContainer, UnfoldedGXContainer>::RET;
}; };
/* The |PartitionY| class defines the partitioning of state variables /* The |PartitionY| class defines the partitioning of state variables

View File

@ -247,9 +247,9 @@ template <class _Ttype>
class GXContainer : public GContainer<_Ttype> class GXContainer : public GContainer<_Ttype>
{ {
public: public:
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename StackContainer<_Ttype>::_Ctype _Ctype; using _Ctype = typename StackContainer<_Ttype>::_Ctype;
typedef typename StackContainer<_Ttype>::itype itype; using itype = typename StackContainer<_Ttype>::itype;
GXContainer(const _Ctype *gs, int ngs, int nu) GXContainer(const _Ctype *gs, int ngs, int nu)
: GContainer<_Ttype>(gs, ngs, nu) : GContainer<_Ttype>(gs, ngs, nu)
{ {
@ -291,9 +291,9 @@ template <class _Ttype>
class ZXContainer : public ZContainer<_Ttype> class ZXContainer : public ZContainer<_Ttype>
{ {
public: public:
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename StackContainer<_Ttype>::_Ctype _Ctype; using _Ctype = typename StackContainer<_Ttype>::_Ctype;
typedef typename StackContainer<_Ttype>::itype itype; using itype = typename StackContainer<_Ttype>::itype;
ZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) ZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu)
: ZContainer<_Ttype>(gss, ngss, g, ng, ny, 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<UGSTensor>, public UnfoldedStackContainer class UnfoldedGXContainer : public GXContainer<UGSTensor>, public UnfoldedStackContainer
{ {
public: public:
typedef TensorContainer<UGSTensor> _Ctype; using _Ctype = TensorContainer<UGSTensor>;
UnfoldedGXContainer(const _Ctype *gs, int ngs, int nu) UnfoldedGXContainer(const _Ctype *gs, int ngs, int nu)
: GXContainer<UGSTensor>(gs, ngs, nu) : GXContainer<UGSTensor>(gs, ngs, nu)
{ {
@ -345,7 +345,7 @@ public:
class FoldedGXContainer : public GXContainer<FGSTensor>, public FoldedStackContainer class FoldedGXContainer : public GXContainer<FGSTensor>, public FoldedStackContainer
{ {
public: public:
typedef TensorContainer<FGSTensor> _Ctype; using _Ctype = TensorContainer<FGSTensor>;
FoldedGXContainer(const _Ctype *gs, int ngs, int nu) FoldedGXContainer(const _Ctype *gs, int ngs, int nu)
: GXContainer<FGSTensor>(gs, ngs, nu) : GXContainer<FGSTensor>(gs, ngs, nu)
{ {
@ -355,7 +355,7 @@ public:
class UnfoldedZXContainer : public ZXContainer<UGSTensor>, public UnfoldedStackContainer class UnfoldedZXContainer : public ZXContainer<UGSTensor>, public UnfoldedStackContainer
{ {
public: public:
typedef TensorContainer<UGSTensor> _Ctype; using _Ctype = TensorContainer<UGSTensor>;
UnfoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) UnfoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu)
: ZXContainer<UGSTensor>(gss, ngss, g, ng, ny, nu) : ZXContainer<UGSTensor>(gss, ngss, g, ng, ny, nu)
{ {
@ -365,7 +365,7 @@ public:
class FoldedZXContainer : public ZXContainer<FGSTensor>, public FoldedStackContainer class FoldedZXContainer : public ZXContainer<FGSTensor>, public FoldedStackContainer
{ {
public: public:
typedef TensorContainer<FGSTensor> _Ctype; using _Ctype = TensorContainer<FGSTensor>;
FoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu) FoldedZXContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, int ny, int nu)
: ZXContainer<FGSTensor>(gss, ngss, g, ng, ny, nu) : ZXContainer<FGSTensor>(gss, ngss, g, ng, ny, nu)
{ {

View File

@ -16,7 +16,7 @@
class MersenneTwister : public RandomGenerator class MersenneTwister : public RandomGenerator
{ {
protected: protected:
typedef unsigned int uint32; using uint32 = unsigned int;
enum {STATE_SIZE = 624}; enum {STATE_SIZE = 624};
enum {RECUR_OFFSET = 397}; enum {RECUR_OFFSET = 397};
uint32 statevec[STATE_SIZE]; uint32 statevec[STATE_SIZE];

View File

@ -26,7 +26,7 @@ namespace ogp
{ {
friend class AtomAsgnEvaluator; friend class AtomAsgnEvaluator;
protected: protected:
typedef std::map<const char *, int, ltstr> Tvarintmap; using Tvarintmap = std::map<const char *, int, ltstr>;
/** All atoms which should be sufficient for formulas at the /** All atoms which should be sufficient for formulas at the
* right hand sides. The atoms should be filled with names * right hand sides. The atoms should be filled with names
* (preregistered). This is a responsibility of the caller. */ * (preregistered). This is a responsibility of the caller. */
@ -88,7 +88,7 @@ namespace ogp
public std::vector<double> public std::vector<double>
{ {
protected: protected:
typedef std::map<int, double> Tusrvalmap; using Tusrvalmap = std::map<int, double>;
Tusrvalmap user_values; Tusrvalmap user_values;
const AtomAssignings &aa; const AtomAssignings &aa;
public: public:

View File

@ -31,10 +31,10 @@ namespace ogp
class AtomSubstitutions class AtomSubstitutions
{ {
public: public:
typedef pair<const char *, int> Tshiftname; using Tshiftname = pair<const char *, int>;
typedef map<const char *, Tshiftname, ltstr> Tshiftmap; using Tshiftmap = map<const char *, Tshiftname, ltstr>;
typedef set<Tshiftname> Tshiftnameset; using Tshiftnameset = set<Tshiftname>;
typedef map<const char *, Tshiftnameset, ltstr> Toldnamemap; using Toldnamemap = map<const char *, Tshiftnameset, ltstr>;
protected: protected:
/** This maps a new name to a shifted old name. This is, one /** This maps a new name to a shifted old name. This is, one
* entry looks as "a_m3 ==> a(-3)", saying that a variable * entry looks as "a_m3 ==> a(-3)", saying that a variable

View File

@ -74,8 +74,8 @@ namespace ogp
{ {
public: public:
/** Type for a map mapping tree indices to double values. */ /** Type for a map mapping tree indices to double values. */
typedef map<int, double> Tconstantmap; using Tconstantmap = map<int, double>;
typedef map<int, int> Tintintmap; using Tintintmap = map<int, int>;
protected: protected:
/** Map mapping a tree index of a constant to its double value. */ /** Map mapping a tree index of a constant to its double value. */
Tconstantmap cmap; Tconstantmap cmap;
@ -124,7 +124,7 @@ namespace ogp
} }
private: private:
/** Inverse map to Tconstantmap. */ /** Inverse map to Tconstantmap. */
typedef map<double, int> Tconstantinvmap; using Tconstantinvmap = map<double, int>;
/** This is an inverse map to cmap. This is only used for fast /** This is an inverse map to cmap. This is only used for fast
* queries for the existing double constants in check * queries for the existing double constants in check
* method and add_constant. */ * method and add_constant. */
@ -140,12 +140,12 @@ namespace ogp
{ {
public: public:
/** Definition of a type mapping lags to the indices of the variables. */ /** Definition of a type mapping lags to the indices of the variables. */
typedef map<int, int> Tlagmap; using Tlagmap = map<int, int>;
protected: protected:
/** Definition of a type mapping names of the atoms to Tlagmap. */ /** Definition of a type mapping names of the atoms to Tlagmap. */
typedef map<const char *, Tlagmap, ltstr> Tvarmap; using Tvarmap = map<const char *, Tlagmap, ltstr>;
/** Definition of a type mapping indices of variables to the variable names. */ /** Definition of a type mapping indices of variables to the variable names. */
typedef map<int, const char *> Tindexmap; using Tindexmap = map<int, const char *>;
/** This is just a storage for variable names, since all other /** This is just a storage for variable names, since all other
* instances of a variable name just point to the memory * instances of a variable name just point to the memory
* allocated by this object. */ * allocated by this object. */

View File

@ -109,7 +109,7 @@ namespace ogp
{ {
protected: protected:
/** Type for a map mapping a variable name to an integer. */ /** Type for a map mapping a variable name to an integer. */
typedef map<const char *, int, ltstr> Tvarintmap; using Tvarintmap = map<const char *, int, ltstr>;
/** Reference to atoms. */ /** Reference to atoms. */
const FineAtoms &atoms; const FineAtoms &atoms;
/** The vector of all endo and exo variables in outer /** The vector of all endo and exo variables in outer
@ -175,7 +175,7 @@ namespace ogp
{ {
friend class AllvarOuterOrdering; friend class AllvarOuterOrdering;
protected: protected:
typedef map<const char *, int, ltstr> Tvarintmap; using Tvarintmap = map<const char *, int, ltstr>;
private: private:
/** The vector of parameters names. The order gives the order /** The vector of parameters names. The order gives the order
* the data is communicated with outside world. */ * the data is communicated with outside world. */

View File

@ -89,7 +89,7 @@ namespace ogp
/** For retrieving derivatives via a multiindex, we have a map /** For retrieving derivatives via a multiindex, we have a map
* mapping a multiindex to a derivative in the tder * mapping a multiindex to a derivative in the tder
* ordering. This means that indices[ind2der[index]] == index. */ * ordering. This means that indices[ind2der[index]] == index. */
typedef map<FoldMultiIndex, int, ltfmi> Tfmiintmap; using Tfmiintmap = map<FoldMultiIndex, int, ltfmi>;
Tfmiintmap ind2der; Tfmiintmap ind2der;
/** The number of variables. */ /** The number of variables. */
int nvar; int nvar;

View File

@ -13,8 +13,8 @@ namespace ogp
class StaticAtoms : public Atoms, public Constants class StaticAtoms : public Atoms, public Constants
{ {
protected: protected:
typedef map<const char *, int, ltstr> Tvarmap; using Tvarmap = map<const char *, int, ltstr>;
typedef map<int, const char *> Tinvmap; using Tinvmap = map<int, const char *>;
/** Storage for names. */ /** Storage for names. */
NameStorage varnames; NameStorage varnames;
/** Outer order of variables. */ /** Outer order of variables. */

View File

@ -22,9 +22,9 @@ namespace ogp
class StaticFineAtoms : public StaticAtoms class StaticFineAtoms : public StaticAtoms
{ {
public: public:
typedef map<int, int> Tintintmap; using Tintintmap = map<int, int>;
protected: protected:
typedef map<const char *, int, ltstr> Tvarintmap; using Tvarintmap = map<const char *, int, ltstr>;
private: private:
/** The vector of parameter names, gives the parameter /** The vector of parameter names, gives the parameter
* ordering. */ * ordering. */

View File

@ -181,22 +181,22 @@ namespace ogp
/** This defines a type for a map mapping the unary and binary /** This defines a type for a map mapping the unary and binary
* operations to their indices. */ * operations to their indices. */
typedef unordered_map<Operation, int, ophash> _Topmap; using _Topmap = unordered_map<Operation, int, ophash>;
typedef _Topmap::value_type _Topval; using _Topval = _Topmap::value_type;
/** This is the map mapping the unary and binary operations to /** This is the map mapping the unary and binary operations to
* the indices of the terms.*/ * the indices of the terms.*/
_Topmap opmap; _Topmap opmap;
/** This is a type for a set of integers. */ /** This is a type for a set of integers. */
typedef unordered_set<int> _Tintset; using _Tintset = unordered_set<int>;
/** This is a vector of integer sets corresponding to the /** This is a vector of integer sets corresponding to the
* nulary terms contained in the term. */ * nulary terms contained in the term. */
vector<_Tintset> nul_incidence; vector<_Tintset> nul_incidence;
/** This is a type of the map from variables (nulary terms) to /** This is a type of the map from variables (nulary terms) to
* the terms. */ * the terms. */
typedef unordered_map<int, int> _Tderivmap; using _Tderivmap = unordered_map<int, int>;
/** This is a vector of derivative mappings. For each term, it /** This is a vector of derivative mappings. For each term, it
* maps variables to the derivatives of the term with respect * maps variables to the derivatives of the term with respect
* to the variables. */ * to the variables. */

View File

@ -24,7 +24,7 @@ namespace ogdyn
/** A definition of a type mapping a string to an integer. Used as /** A definition of a type mapping a string to an integer. Used as
* a substitution map, saying what names are substituted for what * a substitution map, saying what names are substituted for what
* expressions represented by tree indices. */ * expressions represented by tree indices. */
typedef map<const char *, int, ogp::ltstr> Tsubstmap; using Tsubstmap = map<const char *, int, ogp::ltstr>;
class DynareStaticAtoms : public ogp::StaticAtoms class DynareStaticAtoms : public ogp::StaticAtoms
{ {
@ -54,7 +54,7 @@ namespace ogdyn
public: public:
enum atype {endovar, exovar, param}; enum atype {endovar, exovar, param};
protected: protected:
typedef map<const char *, atype, ogp::ltstr> Tatypemap; using Tatypemap = map<const char *, atype, ogp::ltstr>;
/** The map assigining a type to each name. */ /** The map assigining a type to each name. */
Tatypemap atom_type; Tatypemap atom_type;
public: public:

View File

@ -26,7 +26,7 @@ namespace ogdyn
class ForwSubstBuilder class ForwSubstBuilder
{ {
typedef map<int, const char *> Ttermauxmap; using Ttermauxmap = map<int, const char *>;
protected: protected:
/** Reference to the model, to which we will add equations and /** Reference to the model, to which we will add equations and
* change some equations. */ * change some equations. */

View File

@ -150,12 +150,12 @@ namespace ogdyn
friend class MultInitSS; friend class MultInitSS;
public: public:
/** Type for a set of variable names. */ /** Type for a set of variable names. */
typedef unordered_set<const char *> Tvarset; using Tvarset = unordered_set<const char *>;
/** Type for a set of equations. An equation is identified by /** Type for a set of equations. An equation is identified by
* an index to an equation in the equation vector given by * an index to an equation in the equation vector given by
* DynareModel::eqs. The tree index of the i-th formula is * DynareModel::eqs. The tree index of the i-th formula is
* retrieved as DynareModel::egs.formula(i). */ * retrieved as DynareModel::egs.formula(i). */
typedef vector<int> Teqset; using Teqset = vector<int>;
protected: protected:
/** This is a set of variables wrt which the planner /** This is a set of variables wrt which the planner
* optimizes. These could be all endogenous variables, but it * optimizes. These could be all endogenous variables, but it

View File

@ -150,7 +150,7 @@ public:
template <class _Tdiag, class _Tblock, class _Titer> template <class _Tdiag, class _Tblock, class _Titer>
struct _diag_iter struct _diag_iter
{ {
typedef _diag_iter<_Tdiag, _Tblock, _Titer> _Self; using _Self = _diag_iter<_Tdiag, _Tblock, _Titer>;
_Tdiag diag; _Tdiag diag;
_Titer it; _Titer it;
public: public:
@ -197,8 +197,8 @@ public:
class Diagonal class Diagonal
{ {
public: public:
typedef _diag_iter<const Diagonal &, const DiagonalBlock &, list<DiagonalBlock>::const_iterator> const_diag_iter; using const_diag_iter = _diag_iter<const Diagonal &, const DiagonalBlock &, list<DiagonalBlock>::const_iterator>;
typedef _diag_iter<Diagonal &, DiagonalBlock &, list<DiagonalBlock>::iterator> diag_iter; using diag_iter = _diag_iter<Diagonal &, DiagonalBlock &, list<DiagonalBlock>::iterator>;
private: private:
int num_all{0}; int num_all{0};
list<DiagonalBlock> blocks; list<DiagonalBlock> blocks;
@ -281,7 +281,7 @@ private:
template <class _TRef, class _TPtr> template <class _TRef, class _TPtr>
struct _matrix_iter struct _matrix_iter
{ {
typedef _matrix_iter<_TRef, _TPtr> _Self; using _Self = _matrix_iter<_TRef, _TPtr>;
int d_size; int d_size;
bool real; bool real;
_TPtr ptr; _TPtr ptr;
@ -323,8 +323,8 @@ public:
template <class _TRef, class _TPtr> template <class _TRef, class _TPtr>
class _column_iter : public _matrix_iter<_TRef, _TPtr> class _column_iter : public _matrix_iter<_TRef, _TPtr>
{ {
typedef _matrix_iter<_TRef, _TPtr> _Tparent; using _Tparent = _matrix_iter<_TRef, _TPtr>;
typedef _column_iter<_TRef, _TPtr> _Self; using _Self = _column_iter<_TRef, _TPtr>;
int row; int row;
public: public:
_column_iter(_TPtr base, int ds, bool r, int rw) _column_iter(_TPtr base, int ds, bool r, int rw)
@ -358,8 +358,8 @@ public:
template <class _TRef, class _TPtr> template <class _TRef, class _TPtr>
class _row_iter : public _matrix_iter<_TRef, _TPtr> class _row_iter : public _matrix_iter<_TRef, _TPtr>
{ {
typedef _matrix_iter<_TRef, _TPtr> _Tparent; using _Tparent = _matrix_iter<_TRef, _TPtr>;
typedef _row_iter<_TRef, _TPtr> _Self; using _Self = _row_iter<_TRef, _TPtr>;
int col; int col;
public: public:
_row_iter(_TPtr base, int ds, bool r, int cl) _row_iter(_TPtr base, int ds, bool r, int cl)
@ -396,12 +396,12 @@ class SchurDecompZero;
class QuasiTriangular : public SqSylvMatrix class QuasiTriangular : public SqSylvMatrix
{ {
public: public:
typedef _column_iter<const double &, const double *> const_col_iter; using const_col_iter = _column_iter<const double &, const double *>;
typedef _column_iter<double &, double *> col_iter; using col_iter = _column_iter<double &, double *>;
typedef _row_iter<const double &, const double *> const_row_iter; using const_row_iter = _row_iter<const double &, const double *>;
typedef _row_iter<double &, double *> row_iter; using row_iter = _row_iter<double &, double *>;
typedef Diagonal::const_diag_iter const_diag_iter; using const_diag_iter = Diagonal::const_diag_iter;
typedef Diagonal::diag_iter diag_iter; using diag_iter = Diagonal::diag_iter;
protected: protected:
Diagonal diagonal; Diagonal diagonal;
public: public:

View File

@ -13,7 +13,7 @@
class SchurDecompEig : public SchurDecomp class SchurDecompEig : public SchurDecomp
{ {
public: public:
typedef QuasiTriangular::diag_iter diag_iter; using diag_iter = QuasiTriangular::diag_iter;
SchurDecompEig(const SqSylvMatrix &m) : SchurDecomp(m) SchurDecompEig(const SqSylvMatrix &m) : SchurDecomp(m)
{ {
} }

View File

@ -14,7 +14,7 @@ class SimilarityDecomp
SqSylvMatrix *q; SqSylvMatrix *q;
BlockDiagonal *b; BlockDiagonal *b;
SqSylvMatrix *invq; SqSylvMatrix *invq;
typedef BlockDiagonal::diag_iter diag_iter; using diag_iter = BlockDiagonal::diag_iter;
public: public:
SimilarityDecomp(const double *d, int d_size, double log10norm = 3.0); SimilarityDecomp(const double *d, int d_size, double log10norm = 3.0);
virtual virtual

View File

@ -18,7 +18,7 @@ template <class _Type>
struct ParamItem struct ParamItem
{ {
protected: protected:
typedef ParamItem<_Type> _Self; using _Self = ParamItem<_Type>;
status s; status s;
_Type value; _Type value;
public: public:
@ -74,7 +74,7 @@ public:
class SylvParams class SylvParams
{ {
public: public:
typedef enum {iter, recurse} solve_method; using solve_method = enum {iter, recurse};
protected: protected:
class DoubleParamItem : public ParamItem<double> class DoubleParamItem : public ParamItem<double>

View File

@ -76,8 +76,8 @@ private:
/* recursivelly calculates kronecker product of complex vectors (used in getEigSep) */ /* recursivelly calculates kronecker product of complex vectors (used in getEigSep) */
static void multEigVector(KronVector &eig, const Vector &feig, const Vector &keig); static void multEigVector(KronVector &eig, const Vector &feig, const Vector &keig);
/* auxiliary typedefs */ /* auxiliary typedefs */
typedef QuasiTriangular::const_diag_iter const_diag_iter; using const_diag_iter = QuasiTriangular::const_diag_iter;
typedef QuasiTriangular::const_row_iter const_row_iter; using const_row_iter = QuasiTriangular::const_row_iter;
/* called from solvi */ /* called from solvi */
void solviRealAndEliminate(double r, const_diag_iter di, void solviRealAndEliminate(double r, const_diag_iter di,
KronVector &d, double &eig_min) const; KronVector &d, double &eig_min) const;

View File

@ -99,8 +99,8 @@ private:
int n; int n;
list<OrdSequence> classes; list<OrdSequence> classes;
public: public:
typedef list<OrdSequence>::const_iterator const_seqit; using const_seqit = list<OrdSequence>::const_iterator;
typedef list<OrdSequence>::iterator seqit; using seqit = list<OrdSequence>::iterator;
/* The first constructor constructs $\{\{0\},\{1\},\ldots,\{n-1\}\}$. /* The first constructor constructs $\{\{0\},\{1\},\ldots,\{n-1\}\}$.
@ -185,7 +185,7 @@ class EquivalenceSet
int n; int n;
list<Equivalence> equis; list<Equivalence> equis;
public: public:
typedef list<Equivalence>::const_iterator const_iterator; using const_iterator = list<Equivalence>::const_iterator;
EquivalenceSet(int num); EquivalenceSet(int num);
void print(const char *prefix) const; void print(const char *prefix) const;
const_iterator const_iterator

View File

@ -75,9 +75,9 @@ template <class _Ttype>
class FineContainer : public SizeRefinement, public StackContainer<_Ttype> class FineContainer : public SizeRefinement, public StackContainer<_Ttype>
{ {
protected: protected:
typedef StackContainer<_Ttype> _Stype; using _Stype = StackContainer<_Ttype>;
typedef typename StackContainerInterface<_Ttype>::_Ctype _Ctype; using _Ctype = typename StackContainerInterface<_Ttype>::_Ctype;
typedef typename StackContainerInterface<_Ttype>::itype itype; using itype = typename StackContainerInterface<_Ttype>::itype;
_Ctype **const ref_conts; _Ctype **const ref_conts;
const _Stype &stack_cont; const _Stype &stack_cont;
public: public:

View File

@ -50,11 +50,11 @@ struct ltseq
class SparseTensor class SparseTensor
{ {
public: public:
typedef pair<int, double> Item; using Item = pair<int, double>;
typedef multimap<IntSequence, Item, ltseq> Map; using Map = multimap<IntSequence, Item, ltseq>;
typedef Map::const_iterator const_iterator; using const_iterator = Map::const_iterator;
protected: protected:
typedef Map::iterator iterator; using iterator = Map::iterator;
Map m; Map m;
const int dim; const int dim;
@ -128,7 +128,7 @@ public:
class FSSparseTensor : public SparseTensor class FSSparseTensor : public SparseTensor
{ {
public: public:
typedef SparseTensor::const_iterator const_iterator; using const_iterator = SparseTensor::const_iterator;
private: private:
const int nv; const int nv;
const Symmetry sym; const Symmetry sym;
@ -158,7 +158,7 @@ public:
class GSSparseTensor : public SparseTensor class GSSparseTensor : public SparseTensor
{ {
public: public:
typedef SparseTensor::const_iterator const_iterator; using const_iterator = SparseTensor::const_iterator;
private: private:
const TensorDimens tdims; const TensorDimens tdims;
public: public:

View File

@ -92,8 +92,8 @@ template <class _Ttype>
class StackContainerInterface class StackContainerInterface
{ {
public: public:
typedef TensorContainer<_Ttype> _Ctype; using _Ctype = TensorContainer<_Ttype>;
typedef enum { matrix, unit, zero} itype; using itype = enum { matrix, unit, zero};
protected: protected:
const EquivalenceBundle &ebundle; const EquivalenceBundle &ebundle;
public: public:
@ -134,9 +134,9 @@ template <class _Ttype>
class StackContainer : virtual public StackContainerInterface<_Ttype> class StackContainer : virtual public StackContainerInterface<_Ttype>
{ {
public: public:
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename StackContainerInterface<_Ttype>::_Ctype _Ctype; using _Ctype = typename StackContainerInterface<_Ttype>::_Ctype;
typedef typename StackContainerInterface<_Ttype>::itype itype; using itype = typename StackContainerInterface<_Ttype>::itype;
protected: protected:
int num_conts; int num_conts;
IntSequence stack_sizes; IntSequence stack_sizes;
@ -341,10 +341,10 @@ template <class _Ttype>
class ZContainer : public StackContainer<_Ttype> class ZContainer : public StackContainer<_Ttype>
{ {
public: public:
typedef StackContainer<_Ttype> _Tparent; using _Tparent = StackContainer<_Ttype>;
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename _Tparent::_Ctype _Ctype; using _Ctype = typename _Tparent::_Ctype;
typedef typename _Tparent::itype itype; using itype = typename _Tparent::itype;
ZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, ZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng,
int ny, int nu) int ny, int nu)
: _Tparent(4, 2) : _Tparent(4, 2)
@ -390,7 +390,7 @@ class FoldedZContainer : public ZContainer<FGSTensor>,
public FoldedStackContainer public FoldedStackContainer
{ {
public: public:
typedef TensorContainer<FGSTensor> _Ctype; using _Ctype = TensorContainer<FGSTensor>;
FoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, FoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng,
int ny, int nu) int ny, int nu)
: ZContainer<FGSTensor>(gss, ngss, g, ng, ny, nu) : ZContainer<FGSTensor>(gss, ngss, g, ng, ny, nu)
@ -402,7 +402,7 @@ class UnfoldedZContainer : public ZContainer<UGSTensor>,
public UnfoldedStackContainer public UnfoldedStackContainer
{ {
public: public:
typedef TensorContainer<UGSTensor> _Ctype; using _Ctype = TensorContainer<UGSTensor>;
UnfoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng, UnfoldedZContainer(const _Ctype *gss, int ngss, const _Ctype *g, int ng,
int ny, int nu) int ny, int nu)
: ZContainer<UGSTensor>(gss, ngss, g, ng, ny, nu) : ZContainer<UGSTensor>(gss, ngss, g, ng, ny, nu)
@ -424,10 +424,10 @@ template <class _Ttype>
class GContainer : public StackContainer<_Ttype> class GContainer : public StackContainer<_Ttype>
{ {
public: public:
typedef StackContainer<_Ttype> _Tparent; using _Tparent = StackContainer<_Ttype>;
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename StackContainer<_Ttype>::_Ctype _Ctype; using _Ctype = typename StackContainer<_Ttype>::_Ctype;
typedef typename StackContainer<_Ttype>::itype itype; using itype = typename StackContainer<_Ttype>::itype;
GContainer(const _Ctype *gs, int ngs, int nu) GContainer(const _Ctype *gs, int ngs, int nu)
: StackContainer<_Ttype>(4, 1) : StackContainer<_Ttype>(4, 1)
{ {
@ -473,7 +473,7 @@ class FoldedGContainer : public GContainer<FGSTensor>,
public FoldedStackContainer public FoldedStackContainer
{ {
public: public:
typedef TensorContainer<FGSTensor> _Ctype; using _Ctype = TensorContainer<FGSTensor>;
FoldedGContainer(const _Ctype *gs, int ngs, int nu) FoldedGContainer(const _Ctype *gs, int ngs, int nu)
: GContainer<FGSTensor>(gs, ngs, nu) : GContainer<FGSTensor>(gs, ngs, nu)
{ {
@ -484,7 +484,7 @@ class UnfoldedGContainer : public GContainer<UGSTensor>,
public UnfoldedStackContainer public UnfoldedStackContainer
{ {
public: public:
typedef TensorContainer<UGSTensor> _Ctype; using _Ctype = TensorContainer<UGSTensor>;
UnfoldedGContainer(const _Ctype *gs, int ngs, int nu) UnfoldedGContainer(const _Ctype *gs, int ngs, int nu)
: GContainer<UGSTensor>(gs, ngs, nu) : GContainer<UGSTensor>(gs, ngs, nu)
{ {
@ -501,9 +501,9 @@ template <class _Ttype>
class StackProduct class StackProduct
{ {
public: public:
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
typedef typename _Stype::_Ctype _Ctype; using _Ctype = typename _Stype::_Ctype;
typedef typename _Stype::itype itype; using itype = typename _Stype::itype;
protected: protected:
const _Stype &stack_cont; const _Stype &stack_cont;
InducedSymmetries syms; InducedSymmetries syms;
@ -611,8 +611,8 @@ template <class _Ttype>
class KronProdStack : public KronProdAllOptim class KronProdStack : public KronProdAllOptim
{ {
public: public:
typedef StackProduct<_Ttype> _Ptype; using _Ptype = StackProduct<_Ttype>;
typedef StackContainerInterface<_Ttype> _Stype; using _Stype = StackContainerInterface<_Ttype>;
/* Here we construct |KronProdAllOptim| from |StackContainer| and given /* Here we construct |KronProdAllOptim| from |StackContainer| and given
selections of stack items from stack containers in the product. We selections of stack items from stack containers in the product. We

View File

@ -81,29 +81,45 @@ namespace sthread
template<bool condition, class Then, class Else> template<bool condition, class Then, class Else>
struct IF struct IF
{ {
typedef Then RET; using RET = Then;
}; };
template<class Then, class Else> template<class Then, class Else>
struct IF<false, Then, Else> struct IF<false, Then, Else>
{ {
typedef Else RET; using RET = Else;
}; };
enum { posix, empty}; enum { posix, empty};
template <int>
class thread_traits; template <int thread_impl>
class thread;
template <int> template <int>
class detach_thread; class detach_thread;
/* Clear. We have only |run|, |detach_run|, |exit| and |join|, since
this is only a simple interface. */
template <int thread_impl>
struct thread_traits
{
using _Tthread = typename IF<thread_impl == posix, pthread_t, Empty>::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 class of |thread| is clear. The user implements |operator()()|,
the method |run| runs the user's code as joinable thread, |exit| kills the the method |run| runs the user's code as joinable thread, |exit| kills the
execution. */ execution. */
template <int thread_impl> template <int thread_impl>
class thread class thread
{ {
typedef thread_traits<thread_impl> _Ttraits; using _Ttraits = thread_traits<0>;
typedef typename _Ttraits::_Tthread _Tthread; using _Tthread = typename _Ttraits::_Tthread;
_Tthread th; _Tthread th;
public: public:
virtual ~thread() virtual ~thread()
@ -144,10 +160,10 @@ namespace sthread
template <int thread_impl> template <int thread_impl>
class thread_group class thread_group
{ {
typedef thread_traits<thread_impl> _Ttraits; using _Ttraits = thread_traits<thread_impl>;
typedef thread<thread_impl> _Ctype; using _Ctype = thread<thread_impl>;
list<_Ctype *> tlist; list<_Ctype *> tlist;
typedef typename list<_Ctype *>::iterator iterator; using iterator = typename list<_Ctype *>::iterator;
public: public:
static int max_parallel_threads; static int max_parallel_threads;
void 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 <int thread_impl>
struct thread_traits
{
typedef typename IF<thread_impl == posix, pthread_t, Empty>::RET _Tthread;
typedef thread<thread_impl> _Ctype;
typedef detach_thread<thread_impl> _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|. */ /* Clear. We have only |init|, |lock|, and |unlock|. */
struct ltmmkey; struct ltmmkey;
typedef pair<const void *, const char *> mmkey; using mmkey = pair<const void *, const char *>;
template <int thread_impl> template <int thread_impl>
struct mutex_traits struct mutex_traits
{ {
typedef typename IF<thread_impl == posix, pthread_mutex_t, Empty>::RET _Tmutex; using _Tmutex = typename IF<thread_impl == posix, pthread_mutex_t, Empty>::RET;
typedef map<mmkey, pair<_Tmutex, int>, ltmmkey> mutex_int_map; using mutex_int_map = map<mmkey, pair<_Tmutex, int>, ltmmkey>;
static void init(_Tmutex &m); static void init(_Tmutex &m);
static void lock(_Tmutex &m); static void lock(_Tmutex &m);
static void unlock(_Tmutex &m); static void unlock(_Tmutex &m);
@ -274,12 +276,12 @@ namespace sthread
class mutex_map : class mutex_map :
public mutex_traits<thread_impl>::mutex_int_map public mutex_traits<thread_impl>::mutex_int_map
{ {
typedef typename mutex_traits<thread_impl>::_Tmutex _Tmutex; using _Tmutex = typename mutex_traits<thread_impl>::_Tmutex;
typedef mutex_traits<thread_impl> _Mtraits; using _Mtraits = mutex_traits<thread_impl>;
typedef pair<_Tmutex, int> mmval; using mmval = pair<_Tmutex, int>;
typedef map<mmkey, mmval, ltmmkey> _Tparent; using _Tparent = map<mmkey, mmval, ltmmkey>;
typedef typename _Tparent::iterator iterator; using iterator = typename _Tparent::iterator;
typedef typename _Tparent::value_type _mvtype; using _mvtype = typename _Tparent::value_type;
_Tmutex m; _Tmutex m;
public: public:
mutex_map() mutex_map()
@ -340,10 +342,10 @@ namespace sthread
template <int thread_impl> template <int thread_impl>
class synchro class synchro
{ {
typedef typename mutex_traits<thread_impl>::_Tmutex _Tmutex; using _Tmutex = typename mutex_traits<thread_impl>::_Tmutex;
typedef mutex_traits<thread_impl> _Mtraits; using _Mtraits = mutex_traits<0>;
public: public:
typedef mutex_map<thread_impl> mutex_map_t; using mutex_map_t = mutex_map<0>;
private: private:
const void *caller; const void *caller;
const char *iden; const char *iden;
@ -404,8 +406,8 @@ namespace sthread
template <int thread_impl> template <int thread_impl>
struct cond_traits struct cond_traits
{ {
typedef typename IF<thread_impl == posix, pthread_cond_t, Empty>::RET _Tcond; using _Tcond = typename IF<thread_impl == posix, pthread_cond_t, Empty>::RET;
typedef typename mutex_traits<thread_impl>::_Tmutex _Tmutex; using _Tmutex = typename mutex_traits<thread_impl>::_Tmutex;
static void init(_Tcond &cond); static void init(_Tcond &cond);
static void broadcast(_Tcond &cond); static void broadcast(_Tcond &cond);
static void wait(_Tcond &cond, _Tmutex &mutex); static void wait(_Tcond &cond, _Tmutex &mutex);
@ -424,8 +426,8 @@ namespace sthread
template <int thread_impl> template <int thread_impl>
class condition_counter class condition_counter
{ {
typedef typename mutex_traits<thread_impl>::_Tmutex _Tmutex; using _Tmutex = typename mutex_traits<thread_impl>::_Tmutex;
typedef typename cond_traits<thread_impl>::_Tcond _Tcond; using _Tcond = typename cond_traits<thread_impl>::_Tcond;
int counter{0}; int counter{0};
_Tmutex mut; _Tmutex mut;
_Tcond cond; _Tcond cond;
@ -524,11 +526,11 @@ namespace sthread
template<int thread_impl> template<int thread_impl>
class detach_thread_group class detach_thread_group
{ {
typedef thread_traits<thread_impl> _Ttraits; using _Ttraits = thread_traits<thread_impl>;
typedef cond_traits<thread_impl> _Ctraits; using _Ctraits = cond_traits<thread_impl>;
typedef detach_thread<thread_impl> _Ctype; using _Ctype = detach_thread<thread_impl>;
list<_Ctype *> tlist; list<_Ctype *> tlist;
typedef typename list<_Ctype *>::iterator iterator; using iterator = typename list<_Ctype *>::iterator;
condition_counter<thread_impl> counter; condition_counter<thread_impl> counter;
public: public:
static int max_parallel_threads; static int max_parallel_threads;
@ -583,9 +585,9 @@ namespace sthread
/* Here we only define the specializations for POSIX threads. Then we /* Here we only define the specializations for POSIX threads. Then we
define the macros. Note that the |PosixSynchro| class construct itself define the macros. Note that the |PosixSynchro| class construct itself
from the static map defined in {\tt sthreads.cpp}. */ from the static map defined in {\tt sthreads.cpp}. */
typedef detach_thread<posix> PosixThread; using PosixThread = detach_thread<posix>;
typedef detach_thread_group<posix> PosixThreadGroup; using PosixThreadGroup = detach_thread_group<posix>;
typedef synchro<posix> posix_synchro; using posix_synchro = synchro<posix>;
class PosixSynchro : public posix_synchro class PosixSynchro : public posix_synchro
{ {
public: public:
@ -602,9 +604,9 @@ namespace sthread
mutex. |NoSynchro| class is also empty, but an empty constructor is mutex. |NoSynchro| class is also empty, but an empty constructor is
declared. The empty destructor is declared only to avoid ``unused declared. The empty destructor is declared only to avoid ``unused
variable warning''. */ variable warning''. */
typedef thread<empty> NoThread; using NoThread = thread<empty>;
typedef thread_group<empty> NoThreadGroup; using NoThreadGroup = thread_group<empty>;
typedef synchro<empty> no_synchro; using no_synchro = synchro<empty>;
class NoSynchro class NoSynchro
{ {
public: public:

View File

@ -94,13 +94,13 @@ template<class _Ttype>
class TensorContainer class TensorContainer
{ {
protected: protected:
typedef const _Ttype *_const_ptr; using _const_ptr = const _Ttype *;
typedef _Ttype *_ptr; using _ptr = _Ttype *;
typedef map<Symmetry, _ptr, ltsym> _Map; using _Map = map<Symmetry, _ptr, ltsym>;
typedef typename _Map::value_type _mvtype; using _mvtype = typename _Map::value_type;
public: public:
typedef typename _Map::iterator iterator; using iterator = typename _Map::iterator;
typedef typename _Map::const_iterator const_iterator; using const_iterator = typename _Map::const_iterator;
private: private:
int n; int n;
_Map m; _Map m;

View File

@ -97,8 +97,8 @@ class TensorPolynomial : public TensorContainer<_Ttype>
int nr; int nr;
int nv; int nv;
int maxdim; int maxdim;
typedef TensorContainer<_Ttype> _Tparent; using _Tparent = TensorContainer<_Ttype>;
typedef typename _Tparent::_ptr _ptr; using _ptr = typename _Tparent::_ptr;
public: public:
TensorPolynomial(int rows, int vars) TensorPolynomial(int rows, int vars)
: TensorContainer<_Ttype>(1), : TensorContainer<_Ttype>(1),

View File

@ -76,7 +76,7 @@
template<class _Tptr> template<class _Tptr>
class _index class _index
{ {
typedef _index<_Tptr> _Self; using _Self = _index<_Tptr>;
_Tptr tensor; _Tptr tensor;
int offset; int offset;
IntSequence coor; IntSequence coor;
@ -162,7 +162,7 @@ class Tensor : public TwoDMatrix
{ {
public: public:
enum indor {along_row, along_col}; enum indor {along_row, along_col};
typedef _index<const Tensor *> index; using index = _index<const Tensor *>;
protected: protected:
const index in_beg; const index in_beg;
const index in_end; const index in_end;