Skip to content

Commit 3fc6574

Browse files
committed
fix: remove dependency to boost foreach
1 parent 97f2ee3 commit 3fc6574

4 files changed

Lines changed: 14 additions & 17 deletions

File tree

build.jam

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ constant boost_dependencies :
1616
/boost/container_hash//boost_container_hash
1717
/boost/core//boost_core
1818
/boost/detail//boost_detail
19-
/boost/foreach//boost_foreach
2019
/boost/function//boost_function
2120
/boost/integer//boost_integer
2221
/boost/iterator//boost_iterator

include/boost/graph/graphviz.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include <boost/static_assert.hpp>
3535
#include <boost/algorithm/string/replace.hpp>
3636
#include <boost/xpressive/xpressive_static.hpp>
37-
#include <boost/foreach.hpp>
3837

3938
namespace boost
4039
{
@@ -843,13 +842,13 @@ namespace detail
843842
edge_permutation_from_sorting[temp[e]] = e;
844843
}
845844
typedef boost::tuple< id_t, bgl_vertex_t, id_t > v_prop;
846-
BOOST_FOREACH (const v_prop& t, vertex_props)
845+
for (const v_prop& t : vertex_props)
847846
{
848847
put(boost::get< 0 >(t), dp_, boost::get< 1 >(t),
849848
boost::get< 2 >(t));
850849
}
851850
typedef boost::tuple< id_t, bgl_edge_t, id_t > e_prop;
852-
BOOST_FOREACH (const e_prop& t, edge_props)
851+
for (const e_prop& t : edge_props)
853852
{
854853
put(boost::get< 0 >(t), dp_,
855854
edge_permutation_from_sorting[boost::get< 1 >(t)],

include/boost/graph/hawick_circuits.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
#include <algorithm>
1111
#include <boost/assert.hpp>
12-
#include <boost/foreach.hpp>
1312
#include <boost/graph/graph_traits.hpp>
1413
#include <boost/graph/one_bit_color_map.hpp>
1514
#include <boost/graph/properties.hpp>
1615
#include <boost/property_map/property_map.hpp>
1716
#include <boost/range/begin.hpp>
1817
#include <boost/range/end.hpp>
1918
#include <boost/range/iterator.hpp>
19+
#include <boost/range/iterator_range.hpp>
2020
#include <boost/tuple/tuple.hpp> // for boost::tie
2121
#include <boost/type_traits/remove_reference.hpp>
2222
#include <boost/utility/result_of.hpp>
@@ -133,7 +133,7 @@ namespace hawick_circuits_detail
133133
// documented above.
134134
bool blocked_map_starts_all_unblocked() const
135135
{
136-
BOOST_FOREACH (Vertex v, vertices(graph_))
136+
for (Vertex v : boost::make_iterator_range(vertices(graph_)))
137137
if (is_blocked(v))
138138
return false;
139139
return true;
@@ -143,7 +143,7 @@ namespace hawick_circuits_detail
143143
// sharing data structures between iterations does not break the code.
144144
bool all_closed_rows_are_empty() const
145145
{
146-
BOOST_FOREACH (typename ClosedMatrix::reference row, closed_)
146+
for (typename ClosedMatrix::reference row : closed_)
147147
if (!row.empty())
148148
return false;
149149
return true;

src/graphml.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
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

Comments
 (0)