From 52d8bd0b178ac56e7e39a6de3ee9119f44d51b76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 5 Jun 2018 14:56:34 +0200
Subject: [PATCH] Stop using namespace boost globally in ModelTree

Otherwise boost::tuple overrides std::tuple.
---
 src/MinimumFeedbackSet.cc |  2 ++
 src/MinimumFeedbackSet.hh | 15 +++++++--------
 src/ModelTree.cc          | 13 ++++++-------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/MinimumFeedbackSet.cc b/src/MinimumFeedbackSet.cc
index d91391c5..b7a6551d 100644
--- a/src/MinimumFeedbackSet.cc
+++ b/src/MinimumFeedbackSet.cc
@@ -21,6 +21,8 @@
 
 #include "MinimumFeedbackSet.hh"
 
+using namespace boost;
+
 namespace MFS
 {
   void
diff --git a/src/MinimumFeedbackSet.hh b/src/MinimumFeedbackSet.hh
index 7db7d2f9..75722a8f 100644
--- a/src/MinimumFeedbackSet.hh
+++ b/src/MinimumFeedbackSet.hh
@@ -25,17 +25,16 @@
 #include <boost/graph/adjacency_list.hpp>
 
 using namespace std;
-using namespace boost;
 
 namespace MFS
 {
-  using VertexProperty_t = property<vertex_index_t, int,
-                                    property<vertex_index1_t, int,
-                                             property<vertex_degree_t, int,
-                                                      property<vertex_in_degree_t, int,
-                                                               property<vertex_out_degree_t, int >>>>>;
-  using AdjacencyList_t = adjacency_list<listS, listS, bidirectionalS, VertexProperty_t>;
-  using color_t = map<graph_traits<AdjacencyList_t>::vertex_descriptor, default_color_type>;
+  using VertexProperty_t = boost::property<boost::vertex_index_t, int,
+                                           boost::property<boost::vertex_index1_t, int,
+                                                           boost::property<boost::vertex_degree_t, int,
+                                                                           boost::property<boost::vertex_in_degree_t, int,
+                                                                                           boost::property<boost::vertex_out_degree_t, int >>>>>;
+  using AdjacencyList_t = boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, VertexProperty_t>;
+  using color_t = map<boost::graph_traits<AdjacencyList_t>::vertex_descriptor, boost::default_color_type>;
   using vector_vertex_descriptor_t = vector<AdjacencyList_t::vertex_descriptor>;
 
   //! Eliminate a vertex i
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index bb7c84fd..7783af3b 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -30,7 +30,6 @@
 #include <boost/graph/strong_components.hpp>
 #include <boost/graph/topological_sort.hpp>
 
-using namespace boost;
 using namespace MFS;
 
 bool
@@ -40,7 +39,7 @@ ModelTree::computeNormalization(const jacob_map_t &contemporaneous_jacobian, boo
 
   assert(n == symbol_table.endo_nbr());
 
-  using BipartiteGraph = adjacency_list<vecS, vecS, undirectedS>;
+  using BipartiteGraph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS>;
 
   /*
     Vertices 0 to n-1 are for endogenous (using type specific ID)
@@ -124,7 +123,7 @@ ModelTree::computeNormalization(const jacob_map_t &contemporaneous_jacobian, boo
 #endif
 
   // Check if all variables are normalized
-  vector<int>::const_iterator it = find(mate_map.begin(), mate_map.begin() + n, graph_traits<BipartiteGraph>::null_vertex());
+  auto it = find(mate_map.begin(), mate_map.begin() + n, boost::graph_traits<BipartiteGraph>::null_vertex());
   if (it != mate_map.begin() + n)
     {
       if (verbose)
@@ -536,7 +535,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
   AdjacencyList_t G2(n);
 
   // It is necessary to manually initialize vertex_index property since this graph uses listS and not vecS as underlying vertex container
-  property_map<AdjacencyList_t, vertex_index_t>::type v_index = get(vertex_index, G2);
+  auto v_index = get(boost::vertex_index, G2);
   for (int i = 0; i < n; i++)
     put(v_index, vertex(i, G2), i);
 
@@ -571,7 +570,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
                G2);
 
   vector<int> endo2block(num_vertices(G2)), discover_time(num_vertices(G2));
-  iterator_property_map<int *, property_map<AdjacencyList_t, vertex_index_t>::type, int, int &> endo2block_map(&endo2block[0], get(vertex_index, G2));
+  boost::iterator_property_map<int *, boost::property_map<AdjacencyList_t, boost::vertex_index_t>::type, int, int &> endo2block_map(&endo2block[0], get(boost::vertex_index, G2));
 
   // Compute strongly connected components
   int num = strong_components(G2, endo2block_map);
@@ -579,7 +578,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
   blocks = vector<pair<int, int>>(num, { 0, 0 });
 
   // Create directed acyclic graph associated to the strongly connected components
-  using DirectedGraph = adjacency_list<vecS, vecS, directedS>;
+  using DirectedGraph = boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS>;
   DirectedGraph dag(num);
 
   for (unsigned int i = 0; i < num_vertices(G2); i++)
@@ -665,7 +664,7 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock(const jacob
       set<int> feed_back_vertices;
       //Print(G);
       AdjacencyList_t G1 = Minimal_set_of_feedback_vertex(feed_back_vertices, G);
-      property_map<AdjacencyList_t, vertex_index_t>::type v_index = get(vertex_index, G);
+      auto v_index = get(boost::vertex_index, G);
       components_set[i].second.first = feed_back_vertices;
       blocks[i].second = feed_back_vertices.size();
       vector<int> Reordered_Vertice;
-- 
GitLab