From af722f438f490acf845bde3d57320ce442626516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 6 Feb 2019 15:50:01 +0100
Subject: [PATCH] Dynare++: drop remaining "using namespace std"

---
 dynare++/integ/cc/quadrature.hh               |  4 +--
 dynare++/integ/cc/quasi_mcarlo.hh             |  2 +-
 dynare++/integ/cc/smolyak.hh                  |  6 ++--
 dynare++/integ/src/quadrature-points.cc       |  8 ++---
 dynare++/integ/testing/tests.cc               | 12 +++----
 dynare++/kord/decision_rule.cc                |  4 +--
 dynare++/kord/decision_rule.hh                | 12 +++----
 dynare++/kord/journal.cc                      |  4 +--
 dynare++/kord/journal.hh                      |  4 +--
 dynare++/src/dynare3.cc                       | 10 +++---
 dynare++/src/dynare3.hh                       |  8 ++---
 dynare++/src/main.cc                          |  2 +-
 dynare++/tl/cc/equivalence.cc                 |  6 ++--
 dynare++/tl/cc/equivalence.hh                 | 20 +++++------
 dynare++/tl/cc/fine_container.hh              |  4 +--
 dynare++/tl/cc/int_sequence.cc                |  4 +--
 dynare++/tl/cc/int_sequence.hh                |  3 +-
 dynare++/tl/cc/kron_prod.cc                   |  2 +-
 dynare++/tl/cc/permutation.cc                 |  6 ++--
 dynare++/tl/cc/permutation.hh                 |  4 +--
 dynare++/tl/cc/ps_tensor.cc                   |  2 +-
 dynare++/tl/cc/pyramid_prod.cc                |  8 ++---
 dynare++/tl/cc/pyramid_prod.hh                |  6 ++--
 dynare++/tl/cc/rfs_tensor.cc                  |  2 +-
 dynare++/tl/cc/rfs_tensor.hh                  |  2 +-
 dynare++/tl/cc/sparse_tensor.hh               |  6 ++--
 dynare++/tl/cc/symmetry.hh                    |  2 +-
 dynare++/tl/cc/t_container.cc                 |  6 ++--
 dynare++/tl/cc/t_container.hh                 | 12 +++----
 dynare++/tl/cc/t_polynomial.hh                |  2 +-
 .../k_order_perturbation/dynamic_dll.cc       | 12 +++----
 .../k_order_perturbation/dynamic_dll.hh       |  2 +-
 mex/sources/k_order_perturbation/dynamic_m.cc |  2 +-
 mex/sources/k_order_perturbation/dynamic_m.hh |  4 +--
 .../k_order_perturbation/k_ord_dynare.cc      | 30 ++++++++--------
 .../k_order_perturbation/k_ord_dynare.hh      | 30 ++++++++--------
 .../k_order_perturbation.cc                   | 34 +++++++++----------
 37 files changed, 140 insertions(+), 147 deletions(-)

diff --git a/dynare++/integ/cc/quadrature.hh b/dynare++/integ/cc/quadrature.hh
index 83a751498..61df4a58e 100644
--- a/dynare++/integ/cc/quadrature.hh
+++ b/dynare++/integ/cc/quadrature.hh
@@ -184,9 +184,9 @@ public:
 
   /* Just for debugging. */
   void
-  savePoints(const string &fname, int level) const
+  savePoints(const std::string &fname, int level) const
   {
-    ofstream fd{fname, std::ios::out | std::ios::trunc};
+    std::ofstream fd{fname, std::ios::out | std::ios::trunc};
     if (fd.fail())
       {
         // todo: raise
diff --git a/dynare++/integ/cc/quasi_mcarlo.hh b/dynare++/integ/cc/quasi_mcarlo.hh
index ad45955c2..65d92bfed 100644
--- a/dynare++/integ/cc/quasi_mcarlo.hh
+++ b/dynare++/integ/cc/quasi_mcarlo.hh
@@ -83,7 +83,7 @@ private:
 protected:
   int num;
   int maxn;
-  vector<RadicalInverse> ri;
+  std::vector<RadicalInverse> ri;
   const PermutationScheme &per;
   Vector pt;
 public:
diff --git a/dynare++/integ/cc/smolyak.hh b/dynare++/integ/cc/smolyak.hh
index 83d0103e6..3330e4ab2 100644
--- a/dynare++/integ/cc/smolyak.hh
+++ b/dynare++/integ/cc/smolyak.hh
@@ -101,9 +101,9 @@ class SmolyakQuadrature : public QuadratureImpl<smolpit>
   friend class smolpit;
   int level;
   const OneDQuadrature &uquad;
-  vector<IntSequence> levels;
-  vector<IntSequence> levpoints;
-  vector<int> cumevals;
+  std::vector<IntSequence> levels;
+  std::vector<IntSequence> levpoints;
+  std::vector<int> cumevals;
   PascalTriangle psc;
 public:
   SmolyakQuadrature(int d, int l, const OneDQuadrature &uq);
diff --git a/dynare++/integ/src/quadrature-points.cc b/dynare++/integ/src/quadrature-points.cc
index 10cc32257..3fd284e1c 100644
--- a/dynare++/integ/src/quadrature-points.cc
+++ b/dynare++/integ/src/quadrature-points.cc
@@ -22,8 +22,8 @@
 
 struct QuadParams
 {
-  string outname;
-  string vcovname;
+  std::string outname;
+  std::string vcovname;
   int max_level{3};
   double discard_weight{0.0};
   QuadParams(int argc, char **argv);
@@ -60,7 +60,7 @@ QuadParams::QuadParams(int argc, char **argv)
         case opt_max_level:
           try
             {
-              max_level = std::stoi(string{optarg});
+              max_level = std::stoi(std::string{optarg});
             }
           catch (const std::invalid_argument &e)
             {
@@ -70,7 +70,7 @@ QuadParams::QuadParams(int argc, char **argv)
         case opt_discard_weight:
           try
             {
-              discard_weight = std::stod(string{optarg});
+              discard_weight = std::stod(std::string{optarg});
             }
           catch (const std::invalid_argument &e)
             {
diff --git a/dynare++/integ/testing/tests.cc b/dynare++/integ/testing/tests.cc
index b8ae2f8e4..a91e882b9 100644
--- a/dynare++/integ/testing/tests.cc
+++ b/dynare++/integ/testing/tests.cc
@@ -165,11 +165,11 @@ Function1Trans::eval(const Vector &point, const ParameterSignal &sig, Vector &ou
 // with time information
 class WallTimer
 {
-  string mes;
+  std::string mes;
   std::chrono::time_point<std::chrono::high_resolution_clock> start;
   bool new_line;
 public:
-  WallTimer(string m, bool nl = true)
+  WallTimer(std::string m, bool nl = true)
     : mes{m}, start{std::chrono::high_resolution_clock::now()}, new_line{nl}
   {
   }
@@ -189,10 +189,10 @@ public:
 class TestRunnable
 {
 public:
-  const string name;
+  const std::string name;
   int dim; // dimension of the solved problem
   int nvar; // number of variable of the solved problem
-  TestRunnable(string name_arg, int d, int nv)
+  TestRunnable(std::string name_arg, int d, int nv)
     : name{move(name_arg)}, dim(d), nvar(nv)
   {
   }
@@ -211,7 +211,7 @@ protected:
 bool
 TestRunnable::test() const
 {
-  cout << "Running test <" << name << ">" << endl;
+  std::cout << "Running test <" << name << ">" << std::endl;
   bool passed;
   {
     WallTimer tim("Wall clock time ", false);
@@ -286,7 +286,7 @@ TestRunnable::product_normal_moments(const GeneralMatrix &m, int imom, int level
   // check against theoretical moments
   UNormalMoments moments(imom, msq);
   prod_out.add(-1.0, (moments.get(Symmetry(imom)))->getData());
-  std::cout << "\tError:                         " << std::setw(16) << std::setprecision(12) << prod_out.getMax() << endl;
+  std::cout << "\tError:                         " << std::setw(16) << std::setprecision(12) << prod_out.getMax() << std::endl;
   return prod_out.getMax() < 1.e-7;
 }
 
diff --git a/dynare++/kord/decision_rule.cc b/dynare++/kord/decision_rule.cc
index 7afc2b97a..930bf801c 100644
--- a/dynare++/kord/decision_rule.cc
+++ b/dynare++/kord/decision_rule.cc
@@ -437,7 +437,7 @@ RTSimResultsStats::writeMat(mat_t *fd, const char *lname)
 }
 
 IRFResults::IRFResults(const DynamicModel &mod, const DecisionRule &dr,
-                       const SimResults &control, vector<int> ili,
+                       const SimResults &control, std::vector<int> ili,
                        Journal &journal)
   : model(mod), irf_list_ind(std::move(ili))
 {
@@ -639,6 +639,6 @@ GenShockRealization::get(int n, Vector &out)
   Vector r(numShocks());
   RandomShockRealization::get(n, r);
   for (int j = 0; j < numShocks(); j++)
-    if (!isfinite(out[j]))
+    if (!std::isfinite(out[j]))
       out[j] = r[j];
 }
diff --git a/dynare++/kord/decision_rule.hh b/dynare++/kord/decision_rule.hh
index 532c5ec22..359447fb8 100644
--- a/dynare++/kord/decision_rule.hh
+++ b/dynare++/kord/decision_rule.hh
@@ -728,9 +728,9 @@ protected:
   int num_y;
   int num_per;
   int num_burn;
-  vector<TwoDMatrix *> data;
-  vector<ExplicitShockRealization *> shocks;
-  vector<ConstVector> start;
+  std::vector<TwoDMatrix *> data;
+  std::vector<ExplicitShockRealization *> shocks;
+  std::vector<ConstVector> start;
 public:
   SimResults(int ny, int nper, int nburn = 0)
     : num_y(ny), num_per(nper), num_burn(nburn)
@@ -902,12 +902,12 @@ public:
 class DynamicModel;
 class IRFResults
 {
-  vector<SimResultsIRF *> irf_res;
+  std::vector<SimResultsIRF *> irf_res;
   const DynamicModel &model;
-  vector<int> irf_list_ind;
+  std::vector<int> irf_list_ind;
 public:
   IRFResults(const DynamicModel &mod, const DecisionRule &dr,
-             const SimResults &control, vector<int> ili,
+             const SimResults &control, std::vector<int> ili,
              Journal &journal);
   ~IRFResults();
   void writeMat(mat_t *fd, const char *prefix) const;
diff --git a/dynare++/kord/journal.cc b/dynare++/kord/journal.cc
index 1c5fc5e08..825f73037 100644
--- a/dynare++/kord/journal.cc
+++ b/dynare++/kord/journal.cc
@@ -204,7 +204,7 @@ JournalRecordPair::~JournalRecordPair()
   writePrefixForEnd(flash);
   journal << prefix_end;
   journal << mes;
-  journal << endl;
+  journal << std::endl;
   journal.flush();
 }
 
@@ -213,7 +213,7 @@ endrec(JournalRecord &rec)
 {
   rec.journal << rec.prefix;
   rec.journal << rec.mes;
-  rec.journal << endl;
+  rec.journal << std::endl;
   rec.journal.flush();
   rec.journal.incrementOrd();
   return rec;
diff --git a/dynare++/kord/journal.hh b/dynare++/kord/journal.hh
index 380da538a..a32ff385b 100644
--- a/dynare++/kord/journal.hh
+++ b/dynare++/kord/journal.hh
@@ -39,13 +39,13 @@ struct SystemResourcesFlash
   void diff(const SystemResourcesFlash &pre);
 };
 
-class Journal : public ofstream
+class Journal : public std::ofstream
 {
   int ord;
   int depth;
 public:
   Journal(const char *fname)
-    : ofstream(fname), ord(0), depth(0)
+    : std::ofstream(fname), ord(0), depth(0)
   {
     printHeader();
   }
diff --git a/dynare++/src/dynare3.cc b/dynare++/src/dynare3.cc
index ebbf90654..86d3ee12f 100644
--- a/dynare++/src/dynare3.cc
+++ b/dynare++/src/dynare3.cc
@@ -19,10 +19,10 @@
 /**************************************************************************************/
 /*       DynareNameList class                                                         */
 /**************************************************************************************/
-vector<int>
-DynareNameList::selectIndices(const vector<const char *> &ns) const
+std::vector<int>
+DynareNameList::selectIndices(const std::vector<const char *> &ns) const
 {
-  vector<int> res;
+  std::vector<int> res;
   for (auto n : ns)
     {
       int j = 0;
@@ -30,7 +30,7 @@ DynareNameList::selectIndices(const vector<const char *> &ns) const
         j++;
       if (j == getNum())
         throw DynareException(__FILE__, __LINE__,
-                              string("Couldn't find name for ") + n
+                              std::string("Couldn't find name for ") + n
                               +" in DynareNameList::selectIndices");
       res.push_back(j);
     }
@@ -47,7 +47,7 @@ Dynare::Dynare(const char *modname, int ord, double sstol, Journal &jr)
 {
   std::ifstream f{modname};
   if (f.fail())
-    throw DynareException(__FILE__, __LINE__, string{"Could not open model file "}+modname);
+    throw DynareException(__FILE__, __LINE__, std::string{"Could not open model file "}+modname);
 
   std::ostringstream buffer;
   buffer << f.rdbuf();
diff --git a/dynare++/src/dynare3.hh b/dynare++/src/dynare3.hh
index fc6f0a073..6a7fa4846 100644
--- a/dynare++/src/dynare3.hh
+++ b/dynare++/src/dynare3.hh
@@ -20,7 +20,7 @@ class Dynare;
 
 class DynareNameList : public NameList
 {
-  vector<const char *> names;
+  std::vector<const char *> names;
 public:
   DynareNameList(const Dynare &dynare);
   int
@@ -36,12 +36,12 @@ public:
   /** This for each string of the input vector calculates its index
    * in the names. And returns the resulting vector of indices. If
    * the name cannot be found, then an exception is raised. */
-  vector<int> selectIndices(const vector<const char *> &ns) const;
+  std::vector<int> selectIndices(const std::vector<const char *> &ns) const;
 };
 
 class DynareExogNameList : public NameList
 {
-  vector<const char *> names;
+  std::vector<const char *> names;
 public:
   DynareExogNameList(const Dynare &dynare);
   int
@@ -58,7 +58,7 @@ public:
 
 class DynareStateNameList : public NameList
 {
-  vector<const char *> names;
+  std::vector<const char *> names;
 public:
   DynareStateNameList(const Dynare &dynare, const DynareNameList &dnl,
                       const DynareExogNameList &denl);
diff --git a/dynare++/src/main.cc b/dynare++/src/main.cc
index cd92a3bda..8e33c6519 100644
--- a/dynare++/src/main.cc
+++ b/dynare++/src/main.cc
@@ -43,7 +43,7 @@ main(int argc, char **argv)
       // make dynare object
       Dynare dynare(params.modname, params.order, params.ss_tol, journal);
       // make list of shocks for which we will do IRFs
-      vector<int> irf_list_ind;
+      std::vector<int> irf_list_ind;
       if (params.do_irfs_all)
         for (int i = 0; i < dynare.nexog(); i++)
           irf_list_ind.push_back(i);
diff --git a/dynare++/tl/cc/equivalence.cc b/dynare++/tl/cc/equivalence.cc
index 070bf00a1..0b84089eb 100644
--- a/dynare++/tl/cc/equivalence.cc
+++ b/dynare++/tl/cc/equivalence.cc
@@ -313,7 +313,7 @@ EquivalenceSet::EquivalenceSet(int num)
   : n(num),
     equis()
 {
-  list<Equivalence> added;
+  std::list<Equivalence> added;
   Equivalence first(n);
   equis.push_back(first);
   addParents(first, added);
@@ -359,7 +359,7 @@ EquivalenceSet::has(const Equivalence &e) const
 
 void
 EquivalenceSet::addParents(const Equivalence &e,
-                           list<Equivalence> &added)
+                           std::list<Equivalence> &added)
 {
   if (e.numClasses() == 2 || e.numClasses() == 1)
     return;
@@ -396,7 +396,7 @@ EquivalenceSet::print(const char *prefix) const
 /* Construct the bundle. |nmax| is a maximum size of underlying set. */
 EquivalenceBundle::EquivalenceBundle(int nmax)
 {
-  nmax = max(nmax, 1);
+  nmax = std::max(nmax, 1);
   generateUpTo(nmax);
 }
 
diff --git a/dynare++/tl/cc/equivalence.hh b/dynare++/tl/cc/equivalence.hh
index 3f81cae54..34bc61140 100644
--- a/dynare++/tl/cc/equivalence.hh
+++ b/dynare++/tl/cc/equivalence.hh
@@ -44,8 +44,6 @@
 #include <vector>
 #include <list>
 
-using namespace std;
-
 /* Here is the abstraction for an equivalence class. We implement it as
    |vector<int>|. We have a constructor for empty class, copy
    constructor. What is important here is the ordering operator
@@ -55,7 +53,7 @@ using namespace std;
 
 class OrdSequence
 {
-  vector<int> data;
+  std::vector<int> data;
 public:
   OrdSequence() : data()
   {
@@ -68,7 +66,7 @@ public:
   bool operator==(const OrdSequence &s) const;
   int operator[](int i) const;
   bool operator<(const OrdSequence &s) const;
-  const vector<int> &
+  const std::vector<int> &
   getData() const
   {
     return data;
@@ -97,10 +95,10 @@ class Equivalence
 {
 private:
   int n;
-  list<OrdSequence> classes;
+  std::list<OrdSequence> classes;
 public:
-  using const_seqit = list<OrdSequence>::const_iterator;
-  using seqit = list<OrdSequence>::iterator;
+  using const_seqit = std::list<OrdSequence>::const_iterator;
+  using seqit = std::list<OrdSequence>::iterator;
 
   /* The first constructor constructs $\{\{0\},\{1\},\ldots,\{n-1\}\}$.
 
@@ -183,9 +181,9 @@ protected:
 class EquivalenceSet
 {
   int n;
-  list<Equivalence> equis;
+  std::list<Equivalence> equis;
 public:
-  using const_iterator = list<Equivalence>::const_iterator;
+  using const_iterator = std::list<Equivalence>::const_iterator;
   EquivalenceSet(int num);
   void print(const char *prefix) const;
   const_iterator
@@ -200,7 +198,7 @@ public:
   }
 private:
   bool has(const Equivalence &e) const;
-  void addParents(const Equivalence &e, list<Equivalence> &added);
+  void addParents(const Equivalence &e, std::list<Equivalence> &added);
 };
 
 /* The equivalence bundle class only encapsulates |EquivalenceSet|s
@@ -212,7 +210,7 @@ private:
 
 class EquivalenceBundle
 {
-  vector<EquivalenceSet> bundle;
+  std::vector<EquivalenceSet> bundle;
 public:
   EquivalenceBundle(int nmax);
   ~EquivalenceBundle() = default;
diff --git a/dynare++/tl/cc/fine_container.hh b/dynare++/tl/cc/fine_container.hh
index 7ed6a1308..e69f8b26e 100644
--- a/dynare++/tl/cc/fine_container.hh
+++ b/dynare++/tl/cc/fine_container.hh
@@ -39,8 +39,8 @@
 
 class SizeRefinement
 {
-  vector<int> rsizes;
-  vector<int> ind_map;
+  std::vector<int> rsizes;
+  std::vector<int> ind_map;
   int new_nc;
 public:
   SizeRefinement(const IntSequence &s, int nc, int max);
diff --git a/dynare++/tl/cc/int_sequence.cc b/dynare++/tl/cc/int_sequence.cc
index e2f3804a8..21d2676b2 100644
--- a/dynare++/tl/cc/int_sequence.cc
+++ b/dynare++/tl/cc/int_sequence.cc
@@ -29,7 +29,7 @@ IntSequence::IntSequence(const Symmetry &sy, const IntSequence &se)
    constructed sequence must be $(1,1)$, meaning that we picked one $y$
    and one $u$. */
 
-IntSequence::IntSequence(const Symmetry &sy, const vector<int> &se)
+IntSequence::IntSequence(const Symmetry &sy, const std::vector<int> &se)
   : data(new int[sy.num()]), length(sy.num()), destroy(true)
 {
   TL_RAISE_IF(sy.dimen() <= se[se.size()-1],
@@ -102,7 +102,7 @@ IntSequence::operator==(const IntSequence &s) const
 bool
 IntSequence::operator<(const IntSequence &s) const
 {
-  int len = min(size(), s.size());
+  int len = std::min(size(), s.size());
 
   int i = 0;
   while (i < len && operator[](i) == s[i])
diff --git a/dynare++/tl/cc/int_sequence.hh b/dynare++/tl/cc/int_sequence.hh
index dd52ddbf8..a99449caa 100644
--- a/dynare++/tl/cc/int_sequence.hh
+++ b/dynare++/tl/cc/int_sequence.hh
@@ -28,7 +28,6 @@
 #include <cstring>
 #include <vector>
 
-using namespace std;
 
 /* The implementation of |IntSequence| is straightforward. It has a
    pointer |data|, a |length| of the data, and a flag |destroy|, whether
@@ -74,7 +73,7 @@ public:
   {
     memcpy(data, s.data+i1, sizeof(int)*length);
   }
-  IntSequence(const Symmetry &sy, const vector<int> &se);
+  IntSequence(const Symmetry &sy, const std::vector<int> &se);
   IntSequence(const Symmetry &sy, const IntSequence &se);
   IntSequence(int i, const IntSequence &s);
   IntSequence(int i, const IntSequence &s, int pos);
diff --git a/dynare++/tl/cc/kron_prod.cc b/dynare++/tl/cc/kron_prod.cc
index 6191cccdb..16e4c8edb 100644
--- a/dynare++/tl/cc/kron_prod.cc
+++ b/dynare++/tl/cc/kron_prod.cc
@@ -340,7 +340,7 @@ KronProdAll::multRows(const IntSequence &irows) const
 
   Vector *last = nullptr;
   ConstVector *row;
-  vector<Vector *> to_delete;
+  std::vector<Vector *> to_delete;
   for (int i = 0; i < dimen(); i++)
     {
       int j = dimen()-1-i;
diff --git a/dynare++/tl/cc/permutation.cc b/dynare++/tl/cc/permutation.cc
index b5d7a5efb..2bae27771 100644
--- a/dynare++/tl/cc/permutation.cc
+++ b/dynare++/tl/cc/permutation.cc
@@ -103,13 +103,13 @@ PermutationSet::~PermutationSet()
   delete [] pers;
 }
 
-vector<const Permutation *>
+std::vector<const Permutation *>
 PermutationSet::getPreserving(const IntSequence &s) const
 {
   TL_RAISE_IF(s.size() != order,
               "Wrong sequence length in PermutationSet::getPreserving");
 
-  vector<const Permutation *> res;
+  std::vector<const Permutation *> res;
   IntSequence tmp(s.size());
   for (int i = 0; i < size; i++)
     {
@@ -125,7 +125,7 @@ PermutationSet::getPreserving(const IntSequence &s) const
 
 PermutationBundle::PermutationBundle(int nmax)
 {
-  nmax = max(nmax, 1);
+  nmax = std::max(nmax, 1);
   generateUpTo(nmax);
 }
 
diff --git a/dynare++/tl/cc/permutation.hh b/dynare++/tl/cc/permutation.hh
index e6bcc3ac2..a8206d9b5 100644
--- a/dynare++/tl/cc/permutation.hh
+++ b/dynare++/tl/cc/permutation.hh
@@ -155,7 +155,7 @@ public:
   {
     return *(pers[i]);
   }
-  vector<const Permutation *> getPreserving(const IntSequence &s) const;
+  std::vector<const Permutation *> getPreserving(const IntSequence &s) const;
 };
 
 /* The permutation bundle encapsulates all permutations sets up to some
@@ -163,7 +163,7 @@ public:
 
 class PermutationBundle
 {
-  vector<PermutationSet *> bundle;
+  std::vector<PermutationSet *> bundle;
 public:
   PermutationBundle(int nmax);
   ~PermutationBundle();
diff --git a/dynare++/tl/cc/ps_tensor.cc b/dynare++/tl/cc/ps_tensor.cc
index b72118ceb..bd86d5176 100644
--- a/dynare++/tl/cc/ps_tensor.cc
+++ b/dynare++/tl/cc/ps_tensor.cc
@@ -215,7 +215,7 @@ UPSTensor::fillFromSparseTwo(const FSSparseTensor &t, const IntSequence &ss,
     }
 
   const PermutationSet &pset = tls.pbundle->get(coor.size());
-  vector<const Permutation *> pp = pset.getPreserving(coor);
+  std::vector<const Permutation *> pp = pset.getPreserving(coor);
 
   Permutation unsort(coor);
   zeros();
diff --git a/dynare++/tl/cc/pyramid_prod.cc b/dynare++/tl/cc/pyramid_prod.cc
index 4cc5c8af7..1bfcd7925 100644
--- a/dynare++/tl/cc/pyramid_prod.cc
+++ b/dynare++/tl/cc/pyramid_prod.cc
@@ -19,7 +19,7 @@
 USubTensor::USubTensor(const TensorDimens &bdims,
                        const TensorDimens &hdims,
                        const FGSContainer &cont,
-                       const vector<IntSequence> &lst)
+                       const std::vector<IntSequence> &lst)
   : URTensor(lst.size(), hdims.getNVX()[0], hdims.dimen())
 {
   TL_RAISE_IF(!hdims.getNVX().isConstant(),
@@ -31,7 +31,7 @@ USubTensor::USubTensor(const TensorDimens &bdims,
       if (it.numClasses() == hdims.dimen())
         {
           Permutation per(it);
-          vector<const FGSTensor *> ts
+          std::vector<const FGSTensor *> ts
             = cont.fetchTensors(bdims.getSym(), it);
           for (int i = 0; i < (int) lst.size(); i++)
             {
@@ -58,10 +58,10 @@ USubTensor::USubTensor(const TensorDimens &bdims,
    |i|-th column. */
 
 void
-USubTensor::addKronColumn(int i, const vector<const FGSTensor *> &ts,
+USubTensor::addKronColumn(int i, const std::vector<const FGSTensor *> &ts,
                           const IntSequence &pindex)
 {
-  vector<ConstVector> tmpcols;
+  std::vector<ConstVector> tmpcols;
   int lastdim = 0;
   for (auto t : ts)
     {
diff --git a/dynare++/tl/cc/pyramid_prod.hh b/dynare++/tl/cc/pyramid_prod.hh
index 11ba39612..9038ebaa9 100644
--- a/dynare++/tl/cc/pyramid_prod.hh
+++ b/dynare++/tl/cc/pyramid_prod.hh
@@ -54,8 +54,6 @@
 
 #include <vector>
 
-using namespace std;
-
 /* Here we define the new tensor for representing
    $[G]_S^{\gamma_1\ldots\gamma_l}$. It allows a construction from
    container of folded general symmetry tensors |cont|, and set of
@@ -66,8 +64,8 @@ class USubTensor : public URTensor
 {
 public:
   USubTensor(const TensorDimens &bdims, const TensorDimens &hdims,
-             const FGSContainer &cont, const vector<IntSequence> &lst);
-  void addKronColumn(int i, const vector<const FGSTensor *> &ts,
+             const FGSContainer &cont, const std::vector<IntSequence> &lst);
+  void addKronColumn(int i, const std::vector<const FGSTensor *> &ts,
                      const IntSequence &pindex);
 };
 
diff --git a/dynare++/tl/cc/rfs_tensor.cc b/dynare++/tl/cc/rfs_tensor.cc
index d4193e655..944af83c8 100644
--- a/dynare++/tl/cc/rfs_tensor.cc
+++ b/dynare++/tl/cc/rfs_tensor.cc
@@ -115,7 +115,7 @@ URTensor::getOffset(const IntSequence &v) const
 /* Here we construct $v_1\otimes v_2\otimes\ldots\otimes v_n$, where
    $v_1,v_2,\ldots,v_n$ are stored in |vector<ConstVector>|. */
 
-URSingleTensor::URSingleTensor(const vector<ConstVector> &cols)
+URSingleTensor::URSingleTensor(const std::vector<ConstVector> &cols)
   : URTensor(1, cols[0].length(), cols.size())
 {
   if (dimen() == 1)
diff --git a/dynare++/tl/cc/rfs_tensor.hh b/dynare++/tl/cc/rfs_tensor.hh
index c935ed6f9..26717a579 100644
--- a/dynare++/tl/cc/rfs_tensor.hh
+++ b/dynare++/tl/cc/rfs_tensor.hh
@@ -131,7 +131,7 @@ public:
     : URTensor(1, nvar, d)
   {
   }
-  URSingleTensor(const vector<ConstVector> &cols);
+  URSingleTensor(const std::vector<ConstVector> &cols);
   URSingleTensor(const ConstVector &v, int d);
   URSingleTensor(const URSingleTensor &ut)
      
diff --git a/dynare++/tl/cc/sparse_tensor.hh b/dynare++/tl/cc/sparse_tensor.hh
index ef703478b..5cef0f9d9 100644
--- a/dynare++/tl/cc/sparse_tensor.hh
+++ b/dynare++/tl/cc/sparse_tensor.hh
@@ -31,8 +31,6 @@
 
 #include <map>
 
-using namespace std;
-
 // |ltseq| predicate
 struct ltseq
 {
@@ -50,8 +48,8 @@ struct ltseq
 class SparseTensor
 {
 public:
-  using Item = pair<int, double>;
-  using Map = multimap<IntSequence, Item, ltseq>;
+  using Item = std::pair<int, double>;
+  using Map = std::multimap<IntSequence, Item, ltseq>;
   using const_iterator = Map::const_iterator;
 protected:
   using iterator = Map::iterator;
diff --git a/dynare++/tl/cc/symmetry.hh b/dynare++/tl/cc/symmetry.hh
index ea3ee57a7..542f15da3 100644
--- a/dynare++/tl/cc/symmetry.hh
+++ b/dynare++/tl/cc/symmetry.hh
@@ -215,7 +215,7 @@ public:
    symmetries from the given equivalence and outer symmetry. A
    permutation might optionally permute the classes of the equivalence. */
 
-class InducedSymmetries : public vector<Symmetry>
+class InducedSymmetries : public std::vector<Symmetry>
 {
 public:
   InducedSymmetries(const Equivalence &e, const Symmetry &s);
diff --git a/dynare++/tl/cc/t_container.cc b/dynare++/tl/cc/t_container.cc
index f9603269e..d9202d66d 100644
--- a/dynare++/tl/cc/t_container.cc
+++ b/dynare++/tl/cc/t_container.cc
@@ -41,7 +41,7 @@ UGSContainer::multAndAdd(const UGSTensor &t, UGSTensor &out) const
     {
       if (it.numClasses() == l)
         {
-          vector<const UGSTensor *> ts
+          std::vector<const UGSTensor *> ts
             = fetchTensors(out.getSym(), it);
           KronProdAllOptim kp(l);
           for (int i = 0; i < l; i++)
@@ -89,7 +89,7 @@ FGSContainer::multAndAdd(const UGSTensor &t, FGSTensor &out) const
     {
       if (it.numClasses() == l)
         {
-          vector<const FGSTensor *> ts
+          std::vector<const FGSTensor *> ts
             = fetchTensors(out.getSym(), it);
           KronProdAllOptim kp(l);
           for (int i = 0; i < l; i++)
@@ -106,7 +106,7 @@ FGSContainer::multAndAdd(const UGSTensor &t, FGSTensor &out) const
    (excluding). If there are not |num| of such indices, the shorter vector
    is returned. */
 Tensor::index
-FGSContainer::getIndices(int num, vector<IntSequence> &out,
+FGSContainer::getIndices(int num, std::vector<IntSequence> &out,
                          const Tensor::index &start,
                          const Tensor::index &end)
 {
diff --git a/dynare++/tl/cc/t_container.hh b/dynare++/tl/cc/t_container.hh
index 0547fb39b..a467e5ad4 100644
--- a/dynare++/tl/cc/t_container.hh
+++ b/dynare++/tl/cc/t_container.hh
@@ -96,7 +96,7 @@ class TensorContainer
 protected:
   using _const_ptr = const _Ttype *;
   using _ptr = _Ttype *;
-  using _Map = map<Symmetry, _ptr, ltsym>;
+  using _Map = std::map<Symmetry, _ptr, ltsym>;
   using _mvtype = typename _Map::value_type;
 public:
   using iterator = typename _Map::iterator;
@@ -262,9 +262,9 @@ public:
 
   /* Output to the Memory Map. */
   void
-  writeMMap(map<string, ConstTwoDMatrix> &mm, const string &prefix) const
+  writeMMap(std::map<std::string, ConstTwoDMatrix> &mm, const std::string &prefix) const
   {
-    ostringstream lname;
+    std::ostringstream lname;
     for (const_iterator it = begin(); it != end(); ++it)
       {
         lname.str(prefix);
@@ -280,10 +280,10 @@ public:
      through all equivalence classes, calculate implied symmetry, and
      fetch its tensor storing it in the same order to the vector. */
 
-  vector<_const_ptr>
+  std::vector<_const_ptr>
   fetchTensors(const Symmetry &rsym, const Equivalence &e) const
   {
-    vector<_const_ptr> res(e.numClasses());
+    std::vector<_const_ptr> res(e.numClasses());
     int i = 0;
     for (auto it = e.begin();
          it != e.end(); ++it, i++)
@@ -377,7 +377,7 @@ public:
   void multAndAdd(const FGSTensor &t, FGSTensor &out) const;
   void multAndAdd(const UGSTensor &t, FGSTensor &out) const;
 private:
-  static Tensor::index getIndices(int num, vector<IntSequence> &out,
+  static Tensor::index getIndices(int num, std::vector<IntSequence> &out,
                                   const Tensor::index &start,
                                   const Tensor::index &end);
 };
diff --git a/dynare++/tl/cc/t_polynomial.hh b/dynare++/tl/cc/t_polynomial.hh
index 58dd7a57b..f1d258ee2 100644
--- a/dynare++/tl/cc/t_polynomial.hh
+++ b/dynare++/tl/cc/t_polynomial.hh
@@ -340,7 +340,7 @@ public:
         if (_Tparent::check(Symmetry(d)))
           {
             _Ttype *ten = _Tparent::get(Symmetry(d));
-            ten->mult((double) max((d-k), 0));
+            ten->mult((double) std::max((d-k), 0));
           }
       }
   }
diff --git a/mex/sources/k_order_perturbation/dynamic_dll.cc b/mex/sources/k_order_perturbation/dynamic_dll.cc
index 762702e1b..60904e82c 100644
--- a/mex/sources/k_order_perturbation/dynamic_dll.cc
+++ b/mex/sources/k_order_perturbation/dynamic_dll.cc
@@ -21,9 +21,9 @@
 
 #include <sstream>
 
-DynamicModelDLL::DynamicModelDLL(const string &modName) noexcept(false)
+DynamicModelDLL::DynamicModelDLL(const std::string &modName) noexcept(false)
 {
-  string fName;
+  std::string fName;
 #if !defined(__CYGWIN32__) && !defined(_WIN32)
   fName = "./";
 #endif
@@ -57,7 +57,7 @@ DynamicModelDLL::DynamicModelDLL(const string &modName) noexcept(false)
       dynamicHinstance = dlopen(fName.c_str(), RTLD_NOW);
       if (dynamicHinstance == nullptr)
         {
-          cerr << dlerror() << endl;
+          std::cerr << dlerror() << std::endl;
           throw 1;
         }
       ntt = (int *) dlsym(dynamicHinstance, "ntt");
@@ -76,7 +76,7 @@ DynamicModelDLL::DynamicModelDLL(const string &modName) noexcept(false)
           || dynamic_g3_tt == nullptr || dynamic_g3 == nullptr)
         {
           dlclose(dynamicHinstance); // Free the library
-          cerr << dlerror() << endl;
+          std::cerr << dlerror() << std::endl;
           throw 2;
         }
 #endif
@@ -84,7 +84,7 @@ DynamicModelDLL::DynamicModelDLL(const string &modName) noexcept(false)
     }
   catch (int i)
     {
-      ostringstream msg;
+      std::ostringstream msg;
       msg << "Error when loading " << fName << " (";
       if (i == 1)
         msg << "can't dynamically load the file";
@@ -105,7 +105,7 @@ DynamicModelDLL::~DynamicModelDLL()
   auto result = FreeLibrary(dynamicHinstance);
   if (result == 0)
     {
-      cerr << "Can't free the *_dynamic DLL" << endl;
+      std::cerr << "Can't free the *_dynamic DLL" << std::endl;
       exit(EXIT_FAILURE);
     }
 #else
diff --git a/mex/sources/k_order_perturbation/dynamic_dll.hh b/mex/sources/k_order_perturbation/dynamic_dll.hh
index f79aae54c..9385afa35 100644
--- a/mex/sources/k_order_perturbation/dynamic_dll.hh
+++ b/mex/sources/k_order_perturbation/dynamic_dll.hh
@@ -61,7 +61,7 @@ private:
 
 public:
   // construct and load Dynamic model DLL
-  explicit DynamicModelDLL(const string &fname) noexcept(false);
+  explicit DynamicModelDLL(const std::string &fname) noexcept(false);
   virtual ~DynamicModelDLL();
 
   void eval(const Vector &y, const Vector &x, const Vector &params, const Vector &ySteady,
diff --git a/mex/sources/k_order_perturbation/dynamic_m.cc b/mex/sources/k_order_perturbation/dynamic_m.cc
index 45c720d55..6e37c3f54 100644
--- a/mex/sources/k_order_perturbation/dynamic_m.cc
+++ b/mex/sources/k_order_perturbation/dynamic_m.cc
@@ -19,7 +19,7 @@
 
 #include "dynamic_m.hh"
 
-DynamicModelMFile::DynamicModelMFile(const string &modName) noexcept(false) :
+DynamicModelMFile::DynamicModelMFile(const std::string &modName) noexcept(false) :
   DynamicMFilename{modName + ".dynamic"}
 {
 }
diff --git a/mex/sources/k_order_perturbation/dynamic_m.hh b/mex/sources/k_order_perturbation/dynamic_m.hh
index a0b890d12..48c2b396b 100644
--- a/mex/sources/k_order_perturbation/dynamic_m.hh
+++ b/mex/sources/k_order_perturbation/dynamic_m.hh
@@ -32,11 +32,11 @@
 class DynamicModelMFile : public DynamicModelAC
 {
 private:
-  const string DynamicMFilename;
+  const std::string DynamicMFilename;
   const static int nlhs_dynamic = 4;
   const static int nrhs_dynamic = 5;
 public:
-  explicit DynamicModelMFile(const string &modName) noexcept(false);
+  explicit DynamicModelMFile(const std::string &modName) noexcept(false);
   virtual ~DynamicModelMFile() = default;
   void eval(const Vector &y, const Vector &x, const Vector &params, const Vector &ySteady,
             Vector &residual, TwoDMatrix *g1, TwoDMatrix *g2, TwoDMatrix *g3) noexcept(false);
diff --git a/mex/sources/k_order_perturbation/k_ord_dynare.cc b/mex/sources/k_order_perturbation/k_ord_dynare.cc
index 6da182bb8..36d2b2634 100644
--- a/mex/sources/k_order_perturbation/k_ord_dynare.cc
+++ b/mex/sources/k_order_perturbation/k_ord_dynare.cc
@@ -33,13 +33,13 @@
 /*       Dynare DynamicModel class                                                                 */
 /**************************************************************************************/
 
-KordpDynare::KordpDynare(const vector<string> &endo, int num_endo,
-                         const vector<string> &exo, int nexog, int npar,
+KordpDynare::KordpDynare(const std::vector<std::string> &endo, int num_endo,
+                         const std::vector<std::string> &exo, int nexog, int npar,
                          Vector &ysteady, TwoDMatrix &vcov, Vector &inParams, int nstat,
                          int npred, int nforw, int nboth, const int jcols, const Vector &nnzd,
                          const int nsteps, int norder,
-                         Journal &jr, unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
-                         const vector<int> &var_order, const TwoDMatrix &llincidence, double criterium) noexcept(false) :
+                         Journal &jr, std::unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
+                         const std::vector<int> &var_order, const TwoDMatrix &llincidence, double criterium) noexcept(false) :
   nStat{nstat}, nBoth{nboth}, nPred{npred}, nForw{nforw}, nExog{nexog}, nPar{npar},
   nYs{npred + nboth}, nYss{nboth + nforw}, nY{num_endo}, nJcols{jcols}, NNZD{nnzd}, nSteps{nsteps},
   nOrder{norder}, journal{jr}, ySteady{ysteady}, params{inParams}, vCov{vcov},
@@ -54,13 +54,13 @@ KordpDynare::KordpDynare(const vector<string> &endo, int num_endo,
     md.insert(new FSSparseTensor(iord, nY+nYs+nYss+nExog, nY));
 }
 
-KordpDynare::KordpDynare(const vector<string> &endo, int num_endo,
-                         const vector<string> &exo, int nexog, int npar,
+KordpDynare::KordpDynare(const std::vector<std::string> &endo, int num_endo,
+                         const std::vector<std::string> &exo, int nexog, int npar,
                          Vector &ysteady, TwoDMatrix &vcov, Vector &inParams, int nstat,
                          int npred, int nforw, int nboth, const int jcols, const Vector &nnzd,
                          const int nsteps, int norder,
-                         Journal &jr, unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
-                         const vector<int> &var_order, const TwoDMatrix &llincidence, double criterium,
+                         Journal &jr, std::unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
+                         const std::vector<int> &var_order, const TwoDMatrix &llincidence, double criterium,
                          TwoDMatrix *g1_arg, TwoDMatrix *g2_arg, TwoDMatrix *g3_arg) noexcept(false) :
   nStat{nstat}, nBoth{nboth}, nPred{npred}, nForw{nforw}, nExog{nexog}, nPar{npar},
   nYs{npred + nboth}, nYss{nboth + nforw}, nY{num_endo}, nJcols{jcols}, NNZD{nnzd}, nSteps{nsteps},
@@ -159,7 +159,7 @@ KordpDynare::calcDerivativesAtSteady()
  * populateDerivatives to sparse Tensor and fit it in the Derivatives Container
  *******************************************************************************/
 void
-KordpDynare::populateDerivativesContainer(const TwoDMatrix &g, int ord, const vector<int> &vOrder)
+KordpDynare::populateDerivativesContainer(const TwoDMatrix &g, int ord, const std::vector<int> &vOrder)
 {
   // model derivatives FSSparseTensor instance
   FSSparseTensor *mdTi = (new FSSparseTensor(ord, nJcols, nY));
@@ -186,7 +186,7 @@ KordpDynare::populateDerivativesContainer(const TwoDMatrix &g, int ord, const ve
   else if (ord == 2)
     {
       int nJcols1 = nJcols-nExog;
-      vector<int> revOrder(nJcols1);
+      std::vector<int> revOrder(nJcols1);
       for (int i = 0; i < nJcols1; i++)
         revOrder[vOrder[i]] = i;
       for (int i = 0; i < g.nrows(); i++)
@@ -216,7 +216,7 @@ KordpDynare::populateDerivativesContainer(const TwoDMatrix &g, int ord, const ve
     {
       int nJcols1 = nJcols-nExog;
       int nJcols2 = nJcols*nJcols;
-      vector<int> revOrder(nJcols1);
+      std::vector<int> revOrder(nJcols1);
       for (int i = 0; i < nJcols1; i++)
         revOrder[vOrder[i]] = i;
       for (int i = 0; i < g.nrows(); i++)
@@ -311,7 +311,7 @@ KordpDynare::ReorderDynareJacobianIndices() noexcept(false)
   // create temporary square 2D matrix size nEndo x nEndo (sparse)
   // for the lag, current and lead blocks of the jacobian
   JacobianIndices.resize(nJcols);
-  vector <int> tmp(nY);
+  std::vector<int> tmp(nY);
   int i, j, rjoff = nJcols-nExog-1;
 
   for (int ll_row = 0; ll_row < ll_Incidence.nrows(); ll_row++)
@@ -341,7 +341,7 @@ KordpDynare::ReorderDynareJacobianIndices() noexcept(false)
 /*       DynareNameList class                                                         */
 /**************************************************************************************/
 
-DynareNameList::DynareNameList(const KordpDynare &dynare, const vector<string> &names_arg) : names(names_arg)
+DynareNameList::DynareNameList(const KordpDynare &dynare, const std::vector<std::string> &names_arg) : names(names_arg)
 {
 }
 
@@ -349,7 +349,7 @@ DynareStateNameList::DynareStateNameList(const KordpDynare &dynare, const Dynare
                                          const DynareNameList &denl)
 {
   for (int i = 0; i < dynare.nys(); i++)
-    names.push_back(string{dnl.getName(i+dynare.nstat())});
+    names.push_back(std::string{dnl.getName(i+dynare.nstat())});
   for (int i = 0; i < dynare.nexog(); i++)
-    names.push_back(string{denl.getName(i)});
+    names.push_back(std::string{denl.getName(i)});
 }
diff --git a/mex/sources/k_order_perturbation/k_ord_dynare.hh b/mex/sources/k_order_perturbation/k_ord_dynare.hh
index 35d00e20f..49cc1d96e 100644
--- a/mex/sources/k_order_perturbation/k_ord_dynare.hh
+++ b/mex/sources/k_order_perturbation/k_ord_dynare.hh
@@ -42,9 +42,9 @@ class KordpDynare;
 /*////////////////////////////////////////////*/
 class DynareNameList : public NameList
 {
-  vector<string> names;
+  std::vector<std::string> names;
 public:
-  DynareNameList(const KordpDynare &dynare, const vector<string> &names_arg);
+  DynareNameList(const KordpDynare &dynare, const std::vector<std::string> &names_arg);
   int
   getNum() const
   {
@@ -59,7 +59,7 @@ public:
 
 class DynareStateNameList : public NameList
 {
-  vector<string> names;
+  std::vector<std::string> names;
 public:
   DynareStateNameList(const KordpDynare &dynare, const DynareNameList &dnl,
                       const DynareNameList &denl);
@@ -110,30 +110,30 @@ class KordpDynare : public DynamicModel
   DynareNameList dnl, denl;
   DynareStateNameList dsnl;
   const double ss_tol;
-  const vector<int> &varOrder;
+  const std::vector<int> &varOrder;
   const TwoDMatrix &ll_Incidence;
   double qz_criterium;
-  vector<int> JacobianIndices;
+  std::vector<int> JacobianIndices;
 
   TwoDMatrix *g1p;
   TwoDMatrix *g2p;
   TwoDMatrix *g3p;
 public:
-  KordpDynare(const vector<string> &endo, int num_endo,
-              const vector<string> &exo, int num_exo, int num_par,
+  KordpDynare(const std::vector<std::string> &endo, int num_endo,
+              const std::vector<std::string> &exo, int num_exo, int num_par,
               Vector &ySteady, TwoDMatrix &vCov, Vector &params, int nstat, int nPred,
               int nforw, int nboth, const int nJcols, const Vector &NNZD,
               const int nSteps, const int ord,
-              Journal &jr, unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
-              const vector<int> &varOrder, const TwoDMatrix &ll_Incidence,
+              Journal &jr, std::unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
+              const std::vector<int> &varOrder, const TwoDMatrix &ll_Incidence,
               double qz_criterium) noexcept(false);
-  KordpDynare(const vector<string> &endo, int num_endo,
-              const vector<string> &exo, int num_exo, int num_par,
+  KordpDynare(const std::vector<std::string> &endo, int num_endo,
+              const std::vector<std::string> &exo, int num_exo, int num_par,
               Vector &ySteady, TwoDMatrix &vCov, Vector &params, int nstat, int nPred,
               int nforw, int nboth, const int nJcols, const Vector &NNZD,
               const int nSteps, const int ord,
-              Journal &jr, unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
-              const vector<int> &varOrder, const TwoDMatrix &ll_Incidence,
+              Journal &jr, std::unique_ptr<DynamicModelAC> dynamicModelFile_arg, double sstol,
+              const std::vector<int> &varOrder, const TwoDMatrix &ll_Incidence,
               double qz_criterium, TwoDMatrix *g1_arg, TwoDMatrix *g2_arg, TwoDMatrix *g3_arg) noexcept(false);
 
   virtual ~KordpDynare();
@@ -234,7 +234,7 @@ public:
   void evaluateSystem(Vector &out, const ConstVector &yym, const ConstVector &yy,
                       const ConstVector &yyp, const Vector &xx) noexcept(false);
   void calcDerivativesAtSteady();
-  unique_ptr<DynamicModelAC> dynamicModelFile;
+  std::unique_ptr<DynamicModelAC> dynamicModelFile;
   DynamicModel *
   clone() const
   {
@@ -245,7 +245,7 @@ public:
 
 private:
   void ReorderDynareJacobianIndices() noexcept(false);
-  void populateDerivativesContainer(const TwoDMatrix &g, int ord, const vector<int> &vOrder);
+  void populateDerivativesContainer(const TwoDMatrix &g, int ord, const std::vector<int> &vOrder);
 };
 
 #endif
diff --git a/mex/sources/k_order_perturbation/k_order_perturbation.cc b/mex/sources/k_order_perturbation/k_order_perturbation.cc
index 7b119a00d..f374e5641 100644
--- a/mex/sources/k_order_perturbation/k_order_perturbation.cc
+++ b/mex/sources/k_order_perturbation/k_order_perturbation.cc
@@ -49,7 +49,7 @@
 // hence a rather low level approach is needed
 ///////////////////////////////////////////////////////
 void
-DynareMxArrayToString(const mxArray *mxFldp, const int len, const int width, vector<string> &out)
+DynareMxArrayToString(const mxArray *mxFldp, const int len, const int width, std::vector<std::string> &out)
 {
   char *cNamesCharStr = mxArrayToString(mxFldp);
 
@@ -91,7 +91,7 @@ extern "C" {
     if (!mxIsChar(mFname))
       DYN_MEX_FUNC_ERR_MSG_TXT("Input must be of type char.");
 
-    string fName = mxArrayToString(mFname);
+    std::string fName = mxArrayToString(mFname);
 
     int kOrder;
     mxArray *mxFldp = mxGetField(options_, 0, "order");
@@ -152,7 +152,7 @@ extern "C" {
     if (npar != nEndo)
       DYN_MEX_FUNC_ERR_MSG_TXT("Incorrect number of input var_order vars.");
 
-    vector<int> var_order_vp(nEndo);
+    std::vector<int> var_order_vp(nEndo);
     for (int v = 0; v < nEndo; v++)
       var_order_vp[v] = (int) (*(dparams++));
 
@@ -164,7 +164,7 @@ extern "C" {
     TwoDMatrix llincidence(nrows, npar, Vector{mxFldp});
     if (npar != nEndo)
       {
-        ostringstream strstrm;
+        std::ostringstream strstrm;
         strstrm << "dynare:k_order_perturbation " << "Incorrect length of lead lag incidences: ncol=" << npar << " != nEndo=" << nEndo;
         DYN_MEX_FUNC_ERR_MSG_TXT(strstrm.str().c_str());
       }
@@ -179,13 +179,13 @@ extern "C" {
     mxFldp = mxGetField(M_, 0, "var_order_endo_names");
     const int nendo = (int) mxGetM(mxFldp);
     const int widthEndo = (int) mxGetN(mxFldp);
-    vector<string> endoNames;
+    std::vector<std::string> endoNames;
     DynareMxArrayToString(mxFldp, nendo, widthEndo, endoNames);
 
     mxFldp = mxGetField(M_, 0, "exo_names");
     const int nexo = (int) mxGetM(mxFldp);
     const int widthExog = (int) mxGetN(mxFldp);
-    vector<string> exoNames;
+    std::vector<std::string> exoNames;
     DynareMxArrayToString(mxFldp, nexo, widthExog, exoNames);
 
     if ((nEndo != nendo) || (nExog != nexo))
@@ -227,11 +227,11 @@ extern "C" {
         jName += ".jnl";
         Journal journal(jName.c_str());
 
-        unique_ptr<DynamicModelAC> dynamicModelFile;
+        std::unique_ptr<DynamicModelAC> dynamicModelFile;
         if (use_dll == 1)
-          dynamicModelFile = make_unique<DynamicModelDLL>(fName);
+          dynamicModelFile = std::make_unique<DynamicModelDLL>(fName);
         else
-          dynamicModelFile = make_unique<DynamicModelMFile>(fName);
+          dynamicModelFile = std::make_unique<DynamicModelMFile>(fName);
 
         // intiate tensor library
         tls.init(kOrder, nStat+2*nPred+3*nBoth+2*nForw+nExog);
@@ -239,7 +239,7 @@ extern "C" {
         // make KordpDynare object
         KordpDynare dynare(endoNames, nEndo, exoNames, nExog, nPar,
                            ySteady, vCov, modParams, nStat, nPred, nForw, nBoth,
-                           jcols, NNZD, nSteps, kOrder, journal, move(dynamicModelFile),
+                           jcols, NNZD, nSteps, kOrder, journal, std::move(dynamicModelFile),
                            sstol, var_order_vp, llincidence, qz_criterium,
                            g1m, g2m, g3m);
 
@@ -250,8 +250,8 @@ extern "C" {
         app.walkStochSteady();
 
         /* Write derivative outputs into memory map */
-        map<string, ConstTwoDMatrix> mm;
-        app.getFoldDecisionRule().writeMMap(mm, string());
+        std::map<std::string, ConstTwoDMatrix> mm;
+        app.getFoldDecisionRule().writeMMap(mm, std::string());
 
         // get latest ysteady
         ySteady = dynare.getSteady();
@@ -259,7 +259,7 @@ extern "C" {
         if (kOrder == 1)
           {
             /* Set the output pointer to the output matrix ysteady. */
-            map<string, ConstTwoDMatrix>::const_iterator cit = mm.begin();
+            auto cit = mm.begin();
             ++cit;
             plhs[1] = mxCreateDoubleMatrix((*cit).second.numRows(), (*cit).second.numCols(), mxREAL);
 
@@ -271,7 +271,7 @@ extern "C" {
         if (kOrder >= 2)
           {
             int ii = 1;
-            for (map<string, ConstTwoDMatrix>::const_iterator cit = mm.begin();
+            for (auto cit = mm.begin();
                  ((cit != mm.end()) && (ii < nlhs)); ++cit)
               {
                 plhs[ii] = mxCreateDoubleMatrix((*cit).second.numRows(), (*cit).second.numCols(), mxREAL);
@@ -312,7 +312,7 @@ extern "C" {
     catch (const KordException &e)
       {
         e.print();
-        ostringstream strstrm;
+        std::ostringstream strstrm;
         strstrm << "dynare:k_order_perturbation: Caught Kord exception: " << e.get_message();
         DYN_MEX_FUNC_ERR_MSG_TXT(strstrm.str().c_str());
       }
@@ -328,13 +328,13 @@ extern "C" {
       }
     catch (const DynareException &e)
       {
-        ostringstream strstrm;
+        std::ostringstream strstrm;
         strstrm << "dynare:k_order_perturbation: Caught KordDynare exception: " << e.message();
         DYN_MEX_FUNC_ERR_MSG_TXT(strstrm.str().c_str());
       }
     catch (const ogu::Exception &e)
       {
-        ostringstream strstrm;
+        std::ostringstream strstrm;
         strstrm << "dynare:k_order_perturbation: Caught general exception: " << e.message();
         DYN_MEX_FUNC_ERR_MSG_TXT(strstrm.str().c_str());
       }
-- 
GitLab