1111// Tiago de Paula Peixoto
1212
1313#define BOOST_GRAPH_SOURCE
14- #include < boost/foreach.hpp>
1514#include < boost/optional.hpp>
1615#include < boost/throw_exception.hpp>
1716#include < boost/graph/graphml.hpp>
@@ -44,7 +43,7 @@ class graphml_reader
4443 using boost::property_tree::ptree;
4544 size_t current_idx = 0 ;
4645 bool is_first = is_root;
47- BOOST_FOREACH (const ptree::value_type& n, top)
46+ for (const ptree::value_type& n : top)
4847 {
4948 if (n.first == " graph" )
5049 {
@@ -54,7 +53,7 @@ class graphml_reader
5453 if (is_first)
5554 {
5655 is_first = false ;
57- BOOST_FOREACH (const ptree::value_type& attr, n.second )
56+ for (const ptree::value_type& attr : n.second )
5857 {
5958 if (attr.first != " data" )
6059 continue ;
@@ -83,7 +82,7 @@ class graphml_reader
8382 | boost::property_tree::xml_parser::trim_whitespace);
8483 ptree gml = pt.get_child (path (" graphml" ));
8584 // Search for attributes
86- BOOST_FOREACH (const ptree::value_type& child, gml)
85+ for (const ptree::value_type& child : gml)
8786 {
8887 if (child.first != " key" )
8988 continue ;
@@ -127,17 +126,17 @@ class graphml_reader
127126 std::vector< const ptree* > graphs;
128127 handle_graph ();
129128 get_graphs (gml, desired_idx, true , graphs);
130- BOOST_FOREACH (const ptree* gr, graphs)
129+ for (const ptree* gr : graphs)
131130 {
132131 // Search for nodes
133- BOOST_FOREACH (const ptree::value_type& node, *gr)
132+ for (const ptree::value_type& node : *gr)
134133 {
135134 if (node.first != " node" )
136135 continue ;
137136 std::string id
138137 = node.second .get < std::string >(path (" <xmlattr>/id" ));
139138 handle_vertex (id);
140- BOOST_FOREACH (const ptree::value_type& attr, node.second )
139+ for (const ptree::value_type& attr : node.second )
141140 {
142141 if (attr.first != " data" )
143142 continue ;
@@ -148,13 +147,13 @@ class graphml_reader
148147 }
149148 }
150149 }
151- BOOST_FOREACH (const ptree* gr, graphs)
150+ for (const ptree* gr : graphs)
152151 {
153152 bool default_directed
154153 = gr->get < std::string >(path (" <xmlattr>/edgedefault" ))
155154 == " directed" ;
156155 // Search for edges
157- BOOST_FOREACH (const ptree::value_type& edge, *gr)
156+ for (const ptree::value_type& edge : *gr)
158157 {
159158 if (edge.first != " edge" )
160159 continue ;
@@ -180,7 +179,7 @@ class graphml_reader
180179 }
181180 size_t old_edges_size = m_edge.size ();
182181 handle_edge (source, target);
183- BOOST_FOREACH (const ptree::value_type& attr, edge.second )
182+ for (const ptree::value_type& attr : edge.second )
184183 {
185184 if (attr.first != " data" )
186185 continue ;
0 commit comments