Commit 966a1c2a authored by Sébastien Villemot's avatar Sébastien Villemot

Port to C++11 auto keyword

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

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
parent 7e003cc5
......@@ -34,20 +34,20 @@ extern "C" {
if (nhrs < 12 || nlhs != 2)
DYN_MEX_FUNC_ERR_MSG_TXT("dynare_simul_ must have at least 12 input parameters and exactly 2 output arguments.\n");
int order = (int) mxGetScalar(prhs[0]);
auto order = (int) mxGetScalar(prhs[0]);
if (nhrs != 12 + order)
DYN_MEX_FUNC_ERR_MSG_TXT("dynare_simul_ must have exactly 11+order input parameters.\n");
int nstat = (int) mxGetScalar(prhs[1]);
int npred = (int) mxGetScalar(prhs[2]);
int nboth = (int) mxGetScalar(prhs[3]);
int nforw = (int) mxGetScalar(prhs[4]);
int nexog = (int) mxGetScalar(prhs[5]);
auto nstat = (int) mxGetScalar(prhs[1]);
auto npred = (int) mxGetScalar(prhs[2]);
auto nboth = (int) mxGetScalar(prhs[3]);
auto nforw = (int) mxGetScalar(prhs[4]);
auto nexog = (int) mxGetScalar(prhs[5]);
const mxArray *const ystart = prhs[6];
const mxArray *const shocks = prhs[7];
const mxArray *const vcov = prhs[8];
int seed = (int) mxGetScalar(prhs[9]);
auto seed = (int) mxGetScalar(prhs[9]);
const mxArray *const ysteady = prhs[10];
const mwSize *const ystart_dim = mxGetDimensions(ystart);
const mwSize *const shocks_dim = mxGetDimensions(shocks);
......@@ -102,7 +102,7 @@ extern "C" {
ft.zeros();
ConstTwoDMatrix gk_mat(ft.nrows(), ft.ncols(), mxGetPr(gk));
ft.add(1.0, gk_mat);
UFSTensor *ut = new UFSTensor(ft);
auto *ut = new UFSTensor(ft);
pol.insert(ut);
}
// form the decision rule
......
......@@ -33,7 +33,7 @@ double
NormalICDF::get(double x)
{
double xx = (2*normal_icdf_end-1)*std::abs(x-0.5);
int i = (int) floor(xx/normal_icdf_step);
auto i = (int) floor(xx/normal_icdf_step);
double xx1 = normal_icdf_step*i;
double yy1 = normal_icdf_data[i];
double y;
......
......@@ -150,8 +150,8 @@ main(int argc, char **argv)
// sort and uniq
OrderVec ordvec;
std::sort(points.begin(), points.end(), ordvec);
std::vector<Vector *>::iterator new_end = std::unique(points.begin(), points.end());
for (std::vector<Vector *>::iterator it = new_end; it != points.end(); ++it)
auto new_end = std::unique(points.begin(), points.end());
for (auto it = new_end; it != points.end(); ++it)
delete *it;
points.erase(new_end, points.end());
......
......@@ -261,7 +261,7 @@ Approximation::saveRuleDerivs(const FGSContainer &g)
rule_ders_ss = new FGSContainer(4);
for (auto & run : (*rule_ders))
{
FGSTensor *ten = new FGSTensor(ypart.nstat+ypart.npred, ypart.nyss(), *(run.second));
auto *ten = new FGSTensor(ypart.nstat+ypart.npred, ypart.nyss(), *(run.second));
rule_ders_ss->insert(ten);
}
}
......
......@@ -489,7 +489,7 @@ IRFResults::writeMat(mat_t *fd, const char *prefix) const
void
SimulationWorker::operator()()
{
ExplicitShockRealization *esr = new ExplicitShockRealization(sr, np);
auto *esr = new ExplicitShockRealization(sr, np);
TwoDMatrix *m = dr.simulate(em, np, st, *esr);
{
SYNCHRO syn(&res, "simulation");
......@@ -503,7 +503,7 @@ SimulationWorker::operator()()
void
SimulationIRFWorker::operator()()
{
ExplicitShockRealization *esr
auto *esr
= new ExplicitShockRealization(res.control.getShocks(idata));
esr->addToShock(ishock, 0, imp);
const TwoDMatrix &data = res.control.getData(idata);
......
......@@ -200,7 +200,7 @@ DecisionRuleImpl<t>::fillTensors(const _Tg &g, double sigma)
int dfact = 1;
for (int d = 0; d <= g.getMaxDim(); d++, dfact *= d)
{
_Ttensym *g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
auto *g_yud = new _Ttensym(ypart.ny(), ypart.nys()+nu, d);
g_yud->zeros();
// fill tensor of |g_yud| of dimension |d|
......@@ -287,7 +287,7 @@ DecisionRuleImpl<t>::simulate(emethod em, int np, const Vector &ystart,
{
KORD_RAISE_IF(ysteady.length() != ystart.length(),
"Start and steady lengths differ in DecisionRuleImpl::simulate");
TwoDMatrix *res = new TwoDMatrix(ypart.ny(), np);
auto *res = new TwoDMatrix(ypart.ny(), np);
// initialize vectors and subvectors for simulation
/* Here allocate the stack vector $(\Delta y^*, u)$, define the
......@@ -569,7 +569,7 @@ DRFixPoint<t>::fillTensors(const _Tg &g, double sigma)
int dfact = 1;
for (int d = 0; d <= g.getMaxDim(); d++, dfact *= d)
{
_Ttensym *g_yd = new _Ttensym(ypart.ny(), ypart.nys(), d);
auto *g_yd = new _Ttensym(ypart.ny(), ypart.nys(), d);
g_yd->zeros();
int kfact = 1;
for (int k = 0; d+k <= g.getMaxDim(); k++, kfact *= k)
......
......@@ -20,7 +20,7 @@ NameList::writeMat(mat_t *fd, const char *vname) const
if (maxlen == 0)
return;
char *m = new char[getNum()*maxlen];
auto *m = new char[getNum()*maxlen];
for (int i = 0; i < getNum(); i++)
for (int j = 0; j < maxlen; j++)
......
......@@ -122,7 +122,7 @@ FaaDiBruno::estimRefinment(const TensorDimens &tdims, int nr, int l,
{
int nthreads = THREAD_GROUP::max_parallel_threads;
long int per_size1 = tdims.calcUnfoldMaxOffset();
long int per_size2 = (long int) pow((double) tdims.getNVS().getMax(), l);
auto per_size2 = (long int) pow((double) tdims.getNVS().getMax(), l);
double lambda = 0.0;
long int per_size = sizeof(double)*nr
*(long int) (lambda*per_size1+(1-lambda)*per_size2);
......
......@@ -161,7 +161,7 @@ FirstOrder::solve(const TwoDMatrix &fd)
TwoDMatrix vsr(n, n);
lapack_int lwork = 100*n+16;
Vector work(lwork);
lapack_int *bwork = new lapack_int[n];
auto *bwork = new lapack_int[n];
lapack_int info;
lapack_int sdim2 = sdim;
dgges("N", "V", "S", order_eigs, &n, matE.getData().base(), &n,
......
......@@ -101,7 +101,7 @@ ResidFunction::setYU(const Vector &ys, const Vector &xx)
}
else
{
FFSTensor *ten = new FFSTensor(hss->nrows(), hss->nvars(), 0);
auto *ten = new FFSTensor(hss->nrows(), hss->nvars(), 0);
ten->getData() = ysteady_ss;
hss->insert(ten);
}
......
......@@ -346,7 +346,7 @@ KOrder::switchToFolded()
{
if ((*si)[2] == 0 && g<unfold>().check(*si))
{
FGSTensor *ft = new FGSTensor(*(g<unfold>().get(*si)));
auto *ft = new FGSTensor(*(g<unfold>().get(*si)));
insertDerivative<fold>(ft);
if (dim > 1)
{
......@@ -357,7 +357,7 @@ KOrder::switchToFolded()
}
if (G<unfold>().check(*si))
{
FGSTensor *ft = new FGSTensor(*(G<unfold>().get(*si)));
auto *ft = new FGSTensor(*(G<unfold>().get(*si)));
G<fold>().insert(ft);
if (dim > 1)
{
......
......@@ -450,7 +450,7 @@ KOrder::faaDiBrunoG(const Symmetry &sym) const
JournalRecordPair pa(journal);
pa << "Faa Di Bruno G container for " << sym << endrec;
TensorDimens tdims(sym, nvs);
_Ttensor *res = new _Ttensor(ypart.nyss(), tdims);
auto *res = new _Ttensor(ypart.nyss(), tdims);
FaaDiBruno bruno(journal);
bruno.calculate(Gstack<t>(), gss<t>(), *res);
return res;
......@@ -926,7 +926,7 @@ template <int t>
Vector *
KOrder::calcStochShift(int order, double sigma) const
{
Vector *res = new Vector(ny);
auto *res = new Vector(ny);
res->zeros();
int jfac = 1;
for (int j = 1; j <= order; j++, jfac *= j)
......
......@@ -182,7 +182,7 @@ StochForwardDerivs<t>::StochForwardDerivs(const PartitionY &ypart, int nu,
_Tpol g_int_sym(r, ypart.nys()+1);
for (int d = 1; d <= maxd; d++)
{
_Ttensym *ten = new _Ttensym(r, ypart.nys()+1, d);
auto *ten = new _Ttensym(r, ypart.nys()+1, d);
ten->zeros();
for (int i = 0; i <= d; i++)
{
......@@ -492,7 +492,7 @@ KOrderStoch::faaDiBrunoG(const Symmetry &sym) const
JournalRecordPair pa(journal);
pa << "Faa Di Bruno GX container for " << sym << endrec;
TensorDimens tdims(sym, nvs);
_Ttensor *res = new _Ttensor(ypart.nyss(), tdims);
auto *res = new _Ttensor(ypart.nyss(), tdims);
FaaDiBruno bruno(journal);
bruno.calculate(Gstack<t>(), h<t>(), *res);
return res;
......
......@@ -54,7 +54,7 @@ FSSparseTensor *
SparseGenerator::makeTensor(int dim, int nv, int r,
double fill, double m)
{
FSSparseTensor *res = new FSSparseTensor(dim, nv, r);
auto *res = new FSSparseTensor(dim, nv, r);
FFSTensor dummy(0, nv, dim);
for (Tensor::index fi = dummy.begin(); fi != dummy.end(); ++fi)
{
......
......@@ -36,7 +36,7 @@ extern location_type asgn_lloc;
void
AtomAssignings::parse(int length, const char *stream)
{
char *buffer = new char[length+2];
auto *buffer = new char[length+2];
strncpy(buffer, stream, length);
buffer[length] = '\0';
buffer[length+1] = '\0';
......@@ -104,7 +104,7 @@ AtomAssignings::add_assignment(int asgn_off, const char *str, int name_len,
// find the name in the atoms, make copy of name to be able to put
// '\0' at the end
char *buf = new char[name_len+1];
auto *buf = new char[name_len+1];
strncpy(buf, str, name_len);
buf[name_len] = '\0';
// if left hand side is a registered atom, insert it to tree
......@@ -203,7 +203,7 @@ AtomAsgnEvaluator::setValues(EvalTree &et) const
int t = aa.atoms.index(ss);
if (t >= 0)
{
Tusrvalmap::const_iterator it = user_values.find(t);
auto it = user_values.find(t);
if (it == user_values.end())
et.set_nulary(t, nan);
else
......@@ -218,7 +218,7 @@ AtomAsgnEvaluator::set_user_value(const char *name, double val)
int t = aa.atoms.index(name);
if (t >= 0)
{
Tusrvalmap::iterator it = user_values.find(t);
auto it = user_values.find(t);
if (it == user_values.end())
user_values.insert(Tusrvalmap::value_type(t, val));
else
......@@ -240,7 +240,7 @@ AtomAsgnEvaluator::load(int i, double res)
double
AtomAsgnEvaluator::get_value(const char *name) const
{
AtomAssignings::Tvarintmap::const_iterator it = aa.lname2expr.find(name);
auto it = aa.lname2expr.find(name);
if (it == aa.lname2expr.end())
return std::numeric_limits<double>::quiet_NaN();
else
......
......@@ -22,7 +22,7 @@ AtomSubstitutions::AtomSubstitutions(const AtomSubstitutions &as, const FineAtom
for (const auto & it : as.old2new)
{
Tshiftnameset sset;
for (Tshiftnameset::const_iterator itt = it.second.begin();
for (auto itt = it.second.begin();
itt != it.second.end(); ++itt)
sset.insert(Tshiftname(ns.query((*itt).first), (*itt).second));
old2new.insert(Toldnamemap::value_type(ns.query(it.first), sset));
......@@ -42,7 +42,7 @@ AtomSubstitutions::add_substitution(const char *newname, const char *oldname, in
// insert to new2old map
new2old.insert(Tshiftmap::value_type(newname, Tshiftname(oldname, tshift)));
// insert to old2new map
Toldnamemap::iterator it = old2new.find(oldname);
auto it = old2new.find(oldname);
if (it != old2new.end())
(*it).second.insert(Tshiftname(newname, -tshift));
else
......@@ -80,7 +80,7 @@ AtomSubstitutions::substitutions_finished(VarOrdering::ord_type ot)
const char *
AtomSubstitutions::get_new4old(const char *oldname, int tshift) const
{
Toldnamemap::const_iterator it = old2new.find(oldname);
auto it = old2new.find(oldname);
if (it != old2new.end())
{
const Tshiftnameset &sset = (*it).second;
......@@ -96,7 +96,7 @@ AtomSubstitutions::print() const
{
printf("Atom Substitutions:\nOld ==> New:\n");
for (const auto & it : old2new)
for (Tshiftnameset::const_iterator itt = it.second.begin();
for (auto itt = it.second.begin();
itt != it.second.end(); ++itt)
printf(" %s ==> [%s, %d]\n", it.first, (*itt).first, (*itt).second);
......@@ -164,7 +164,7 @@ SAtoms::findNameWithLeadInInterval(const vector<const char *> &names,
{
for (auto name : names)
{
DynamicAtoms::Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
if (it != vars.end())
{
const DynamicAtoms::Tlagmap &lmap = (*it).second;
......
......@@ -28,7 +28,7 @@ void
CSVParser::csv_parse(int length, const char *str)
{
// allocate temporary buffer and parse
char *buffer = new char[length+2];
auto *buffer = new char[length+2];
strncpy(buffer, str, length);
buffer[length] = '\0';
buffer[length+1] = '\0';
......
......@@ -14,7 +14,7 @@ NameStorage::NameStorage(const NameStorage &stor)
{
for (auto i : stor.name_store)
{
char *str = new char[strlen(i)+1];
auto *str = new char[strlen(i)+1];
strcpy(str, i);
name_store.push_back(str);
name_set.insert(str);
......@@ -33,7 +33,7 @@ NameStorage::~NameStorage()
const char *
NameStorage::query(const char *name) const
{
set<const char *, ltstr>::const_iterator it = name_set.find(name);
auto it = name_set.find(name);
if (it == name_set.end())
return NULL;
else
......@@ -43,10 +43,10 @@ NameStorage::query(const char *name) const
const char *
NameStorage::insert(const char *name)
{
set<const char *, ltstr>::const_iterator it = name_set.find(name);
auto it = name_set.find(name);
if (it == name_set.end())
{
char *str = new char[strlen(name)+1];
auto *str = new char[strlen(name)+1];
strcpy(str, name);
name_store.push_back(str);
name_set.insert(str);
......@@ -97,14 +97,14 @@ Constants::is_constant(int t) const
{
if (t < OperationTree::num_constants)
return true;
Tconstantmap::const_iterator it = cmap.find(t);
auto it = cmap.find(t);
return (it != cmap.end());
}
double
Constants::get_constant_value(int t) const
{
Tconstantmap::const_iterator it = cmap.find(t);
auto it = cmap.find(t);
if (it != cmap.end())
return (*it).second;
else
......@@ -120,7 +120,7 @@ Constants::check(const char *str) const
{
double d;
sscanf(str, "%lf", &d);
Tconstantinvmap::const_iterator it = cinvmap.find(d);
auto it = cinvmap.find(d);
if (it != cinvmap.end())
return (*it).second;
else
......@@ -170,12 +170,12 @@ DynamicAtoms::check_variable(const char *name) const
string str;
int ll;
parse_variable(name, str, ll);
Tvarmap::const_iterator it = vars.find(str.c_str());
auto it = vars.find(str.c_str());
if (it != vars.end())
{
const Tlagmap &lmap = (*it).second;
Tlagmap::const_iterator itt = lmap.find(ll);
auto itt = lmap.find(ll);
if (itt != lmap.end())
return (*itt).second;
}
......@@ -220,7 +220,7 @@ DynamicAtoms::assign_variable(const char *varname, int ll, int t)
throw ogu::Exception(__FILE__, __LINE__,
"Attempt to assign already allocated tree index");
Tvarmap::iterator it = vars.find(varname);
auto it = vars.find(varname);
if (it != vars.end())
{
Tlagmap &lmap = (*it).second;
......@@ -247,11 +247,11 @@ DynamicAtoms::assign_variable(const char *varname, int ll, int t)
void
DynamicAtoms::unassign_variable(const char *varname, int ll, int t)
{
Tvarmap::iterator it = vars.find(varname);
auto it = vars.find(varname);
if (it != vars.end())
{
Tlagmap &lmap = (*it).second;
Tlagmap::iterator itt = lmap.find(ll);
auto itt = lmap.find(ll);
if (itt != lmap.end())
{
if ((*itt).second == t)
......@@ -262,7 +262,7 @@ DynamicAtoms::unassign_variable(const char *varname, int ll, int t)
if (lmap.size() == 0)
vars.erase(it);
// erase it from the indices
Tindexmap::iterator ittt = indices.find(t);
auto ittt = indices.find(t);
if (ittt != indices.end())
indices.erase(ittt);
......@@ -318,7 +318,7 @@ DynamicAtoms::variables() const
void
DynamicAtoms::varspan(int t, int &mlead, int &mlag) const
{
Tindexmap::const_iterator it = indices.find(t);
auto it = indices.find(t);
if (indices.end() == it)
{
mlead = INT_MIN;
......@@ -331,7 +331,7 @@ DynamicAtoms::varspan(int t, int &mlead, int &mlag) const
void
DynamicAtoms::varspan(const char *name, int &mlead, int &mlag) const
{
Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
if (vars.end() == it)
{
mlead = INT_MIN;
......@@ -339,8 +339,8 @@ DynamicAtoms::varspan(const char *name, int &mlead, int &mlag) const
return;
}
const Tlagmap &lmap = (*it).second;
Tlagmap::const_iterator beg = lmap.begin();
Tlagmap::const_reverse_iterator end = lmap.rbegin();
auto beg = lmap.begin();
auto end = lmap.rbegin();
mlag = (*beg).first;
mlead = (*end).first;
}
......@@ -370,11 +370,11 @@ DynamicAtoms::is_named_atom(int t) const
int
DynamicAtoms::index(const char *name, int ll) const
{
Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
if (vars.end() != it)
{
const Tlagmap &lmap = (*it).second;
Tlagmap::const_iterator itt = lmap.find(ll);
auto itt = lmap.find(ll);
if (lmap.end() != itt)
return (*itt).second;
}
......@@ -384,14 +384,14 @@ DynamicAtoms::index(const char *name, int ll) const
bool
DynamicAtoms::is_referenced(const char *name) const
{
Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
return it != vars.end();
}
const DynamicAtoms::Tlagmap &
DynamicAtoms::lagmap(const char *name) const
{
Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
if (vars.end() == it)
throw ogu::Exception(__FILE__, __LINE__,
std::string("Couldn't find the name ")
......@@ -402,7 +402,7 @@ DynamicAtoms::lagmap(const char *name) const
const char *
DynamicAtoms::name(int t) const
{
Tindexmap::const_iterator it = indices.find(t);
auto it = indices.find(t);
if (indices.end() == it)
throw ogu::Exception(__FILE__, __LINE__,
"Couldn't find tree index in DynamicAtoms::name");
......@@ -414,7 +414,7 @@ DynamicAtoms::lead(int t) const
{
const char *nam = name(t);
const Tlagmap &lmap = lagmap(nam);
Tlagmap::const_iterator it = lmap.begin();
auto it = lmap.begin();
while (it != lmap.end() && (*it).second != t)
++it;
if (lmap.end() == it)
......@@ -462,14 +462,14 @@ VarOrdering::VarOrdering(const VarOrdering &vo, const vector<const char *> &vnam
bool
VarOrdering::check(int t) const
{
map<int, int>::const_iterator it = positions.find(t);
auto it = positions.find(t);
return it != positions.end();
}
int
VarOrdering::get_pos_of(int t) const
{
map<int, int>::const_iterator it = positions.find(t);
auto it = positions.find(t);
if (it != positions.end())
{
return (*it).second;
......
......@@ -29,7 +29,7 @@ AllvarOuterOrdering::AllvarOuterOrdering(const vector<const char *> &allvar_oute
// fill in endo2all and exo2all
for (unsigned int i = 0; i < allvar.size(); i++)
{
Tvarintmap::const_iterator it = atoms.endo_outer_map.find(allvar[i]);
auto it = atoms.endo_outer_map.find(allvar[i]);
if (it != atoms.endo_outer_map.end())
endo2all[(*it).second] = i;
else
......@@ -387,7 +387,7 @@ FineAtoms::get_exo_atoms_map() const
int
FineAtoms::name2outer_param(const char *name) const
{
Tvarintmap::const_iterator it = param_outer_map.find(name);
auto it = param_outer_map.find(name);
if (it == param_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not a parameter in FineAtoms::name2outer_param");
......@@ -397,7 +397,7 @@ FineAtoms::name2outer_param(const char *name) const
int
FineAtoms::name2outer_endo(const char *name) const
{
Tvarintmap::const_iterator it = endo_outer_map.find(name);
auto it = endo_outer_map.find(name);
if (it == endo_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not an endogenous variable in FineAtoms::name2outer_endo");
......@@ -407,7 +407,7 @@ FineAtoms::name2outer_endo(const char *name) const
int
FineAtoms::name2outer_exo(const char *name) const
{
Tvarintmap::const_iterator it = exo_outer_map.find(name);
auto it = exo_outer_map.find(name);
if (it == exo_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not an exogenous variable in FineAtoms::name2outer_exo");
......@@ -421,7 +421,7 @@ FineAtoms::name2outer_allvar(const char *name) const
throw ogu::Exception(__FILE__, __LINE__,
"FineAtoms::name2outer_allvar called beore parsing_finished");
Tvarintmap::const_iterator it = endo_outer_map.find(name);
auto it = endo_outer_map.find(name);
if (it != endo_outer_map.end())
return allvar_order->get_endo2all()[(*it).second];
else
......
......@@ -133,7 +133,7 @@ extern location_type fmla_lloc;
void
FormulaParser::parse(int length, const char *stream)
{
char *buffer = new char[length+2];
auto *buffer = new char[length+2];
strncpy(buffer, stream, length);
buffer[length] = '\0';
buffer[length+1] = '\0';
......@@ -273,7 +273,7 @@ FormulaDerivatives::derivative(const FoldMultiIndex &mi) const
throw ogu::Exception(__FILE__, __LINE__,
"Wrong multi-index variables in FormulaDerivatives::derivative");
Tfmiintmap::const_iterator it = ind2der.find(mi);
auto it = ind2der.find(mi);
if (it == ind2der.end())
return OperationTree::zero;
else
......@@ -428,7 +428,7 @@ int
FoldMultiIndex::offset() const
{
// make copy for the recursions
int *tmp = new int[ord];
auto *tmp = new int[ord];
for (int i = 0; i < ord; i++)
tmp[i] = data[i];
// call the recursive algorithm
......@@ -499,11 +499,11 @@ FormulaDerEvaluator::eval(const AtomValues &av, FormulaDerEvalLoader &loader, in
etree.reset_all();
av.setValues(etree);
int *vars = new int[order];
auto *vars = new int[order];
for (unsigned int i = 0; i < ders.size(); i++)
{
for (FormulaDerivatives::Tfmiintmap::const_iterator it = ders[i]->ind2der.begin();
for (auto it = ders[i]->ind2der.begin();
it != ders[i]->ind2der.end(); ++it)
{
const FoldMultiIndex &mi = (*it).first;
......@@ -532,7 +532,7 @@ FormulaDerEvaluator::eval(const vector<int> &mp, const AtomValues &av,
int nvar_glob = der_atoms.size();
int nvar = mp.size();
int *vars = new int[order];
auto *vars = new int[order];
for (unsigned int i = 0; i < ders.size(); i++)
{
......
......@@ -29,7 +29,7 @@ MatrixParser::parse(int length, const char *stream)
row_lengths.clear();
nc = 0;
// allocate temporary buffer and parse
char *buffer = new char[length+2];
auto *buffer = new char[length+2];
strncpy(buffer, stream, length);
buffer[length] = '\0';
buffer[length+1] = '\0';
......
......@@ -19,7 +19,7 @@ void namelist_parse();
void
NameListParser::namelist_parse(int length, const char *stream)
{
char *buffer = new char[length+2];
auto *buffer = new char[length+2];
strncpy(buffer, stream, length);
buffer[length] = '\0';
buffer[length+1] = '\0';
......
......@@ -72,7 +72,7 @@ StaticAtoms::check(const char *name) const
int
StaticAtoms::index(const char *name) const
{
Tvarmap::const_iterator it = vars.find(name);
auto it = vars.find(name);
if (it == vars.end())
return -1;
else
......@@ -82,7 +82,7 @@ StaticAtoms::index(const char *name) const
const char *
StaticAtoms::inv_index(int t) const
{
Tinvmap::const_iterator it = indices.find(t);
auto it = indices.find(t);
if (it == indices.end())
return NULL;
else
......
......@@ -135,7 +135,7 @@ StaticFineAtoms::parsing_finished()
int
StaticFineAtoms::name2outer_param(const char *name) const
{
Tvarintmap::const_iterator it = param_outer_map.find(name);
auto it = param_outer_map.find(name);
if (it == param_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not a parameter in StaticFineAtoms::name2outer_param");
......@@ -145,7 +145,7 @@ StaticFineAtoms::name2outer_param(const char *name) const
int
StaticFineAtoms::name2outer_endo(const char *name) const
{
Tvarintmap::const_iterator it = endo_outer_map.find(name);
auto it = endo_outer_map.find(name);
if (it == endo_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not an endogenous variable in StaticFineAtoms::name2outer_endo");
......@@ -155,7 +155,7 @@ StaticFineAtoms::name2outer_endo(const char *name) const
int
StaticFineAtoms::name2outer_exo(const char *name) const
{
Tvarintmap::const_iterator it = exo_outer_map.find(name);
auto it = exo_outer_map.find(name);
if (it == exo_outer_map.end())
throw ogu::Exception(__FILE__, __LINE__,
"Name is not an exogenous variable in StaticFineAtoms::name2outer_exo");
......
......@@ -54,7 +54,7 @@ OperationTree::add_unary(code_t code, int op)
return one;
Operation unary(code, op);
_Topmap::const_iterator i = ((const _Topmap &) opmap).find(unary);
auto i = ((const _Topmap &) opmap).find(unary);
if (i == opmap.end())
{
int newop = terms.size();
......@@ -144,7 +144,7 @@ OperationTree::add_binary(code_t code, int op1, int op2)
// construct operation and check/add it
Operation binary(code, op1, op2);
_Topmap::const_iterator i = ((const _Topmap &) opmap).find(binary);
auto i = ((const _Topmap &) opmap).find(binary);
if (i == opmap.end())
{