diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7e228d91..0e294eb5b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ target_link_libraries(boost_graph
Boost::conversion
Boost::core
Boost::detail
+ Boost::foreach
Boost::function
Boost::integer
Boost::iterator
diff --git a/doc/incremental_components.html b/doc/incremental_components.html
index 4fa0c7d0e..a0c9de00d 100644
--- a/doc/incremental_components.html
+++ b/doc/incremental_components.html
@@ -142,7 +142,7 @@
Example
print_graph(graph, get(boost::vertex_index, graph));
std::cout << std::endl;
- for (Vertex current_vertex: vertices(graph)) {
+ BOOST_FOREACH(Vertex current_vertex, vertices(graph)) {
std::cout << "representative[" << current_vertex << "] = " <<
ds.find_set(current_vertex) << std::endl;
}
@@ -158,11 +158,12 @@ Example
Components components(parent.begin(), parent.end());
// Iterate through the component indices
- for (VertexIndex current_index: components) {
+ BOOST_FOREACH(VertexIndex current_index, components) {
std::cout << "component " << current_index << " contains: ";
// Iterate through the child vertex indices for [current_index]
- for (VertexIndex child_index: components[current_index]) {
+ BOOST_FOREACH(VertexIndex child_index,
+ components[current_index]) {
std::cout << child_index << " ";
}
diff --git a/example/graph-thingie.cpp b/example/graph-thingie.cpp
index b0fef9b48..3902a0fe6 100644
--- a/example/graph-thingie.cpp
+++ b/example/graph-thingie.cpp
@@ -11,6 +11,7 @@
#include
#include
+#include
#include
#include
#include
@@ -98,7 +99,7 @@ int main()
cout << "graph " << get("name", dp, &graph) << " ("
<< get("identifier", dp, &graph) << ")\n\n";
- for (graph_t::vertex_descriptor v: vertices(graph))
+ BOOST_FOREACH (graph_t::vertex_descriptor v, vertices(graph))
{
cout << "vertex " << get("node_id", dp, v) << " ("
<< get("label", dp, v) << ")\n";
diff --git a/example/incremental-components-eg.cpp b/example/incremental-components-eg.cpp
index ec32fe7d2..7fead1d95 100644
--- a/example/incremental-components-eg.cpp
+++ b/example/incremental-components-eg.cpp
@@ -11,6 +11,7 @@
#include
#include
+#include
#include
#include
#include
@@ -52,7 +53,7 @@ int main(int argc, char* argv[])
ds.union_set(4, 0);
ds.union_set(2, 5);
- for (Vertex current_vertex: vertices(graph))
+ BOOST_FOREACH (Vertex current_vertex, vertices(graph))
{
std::cout << "representative[" << current_vertex
<< "] = " << ds.find_set(current_vertex) << std::endl;
@@ -68,12 +69,12 @@ int main(int argc, char* argv[])
Components components(parent.begin(), parent.end());
// Iterate through the component indices
- for (VertexIndex component_index: components)
+ BOOST_FOREACH (VertexIndex component_index, components)
{
std::cout << "component " << component_index << " contains: ";
// Iterate through the child vertex indices for [component_index]
- for (VertexIndex child_index: components[component_index])
+ BOOST_FOREACH (VertexIndex child_index, components[component_index])
{
std::cout << child_index << " ";
}
diff --git a/example/incremental_components.cpp b/example/incremental_components.cpp
index 98ebcd381..249e16bde 100644
--- a/example/incremental_components.cpp
+++ b/example/incremental_components.cpp
@@ -10,6 +10,7 @@
#include
#include
+#include
#include
#include
#include
@@ -85,7 +86,7 @@ int main(int argc, char* argv[])
print_graph(graph, get(boost::vertex_index, graph));
std::cout << std::endl;
- for (Vertex current_vertex: vertices(graph))
+ BOOST_FOREACH (Vertex current_vertex, vertices(graph))
{
std::cout << "representative[" << current_vertex
<< "] = " << ds.find_set(current_vertex) << std::endl;
@@ -102,12 +103,12 @@ int main(int argc, char* argv[])
Components components(parent.begin(), parent.end());
// Iterate through the component indices
- for (VertexIndex current_index: components)
+ BOOST_FOREACH (VertexIndex current_index, components)
{
std::cout << "component " << current_index << " contains: ";
// Iterate through the child vertex indices for [current_index]
- for (VertexIndex child_index: components[current_index])
+ BOOST_FOREACH (VertexIndex child_index, components[current_index])
{
std::cout << child_index << " ";
}
diff --git a/test/grid_graph_test.cpp b/test/grid_graph_test.cpp
index 858453a83..7faff8df2 100644
--- a/test/grid_graph_test.cpp
+++ b/test/grid_graph_test.cpp
@@ -12,6 +12,7 @@
#include
#include
+#include
#include
#include
#include
@@ -99,7 +100,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
// Verify all vertices are within bounds
vertices_size_type vertex_count = 0;
- for (vertex_descriptor current_vertex: vertices(graph))
+ BOOST_FOREACH (vertex_descriptor current_vertex, vertices(graph))
{
vertices_size_type current_index
@@ -117,7 +118,8 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
edges_size_type out_edge_count = 0;
std::set< vertices_size_type > target_vertices;
- for (edge_descriptor out_edge: out_edges(current_vertex, graph))
+ BOOST_FOREACH (
+ edge_descriptor out_edge, out_edges(current_vertex, graph))
{
target_vertices.insert(
@@ -131,7 +133,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
// Verify in-edges of this vertex
edges_size_type in_edge_count = 0;
- for (edge_descriptor in_edge: in_edges(current_vertex, graph))
+ BOOST_FOREACH (edge_descriptor in_edge, in_edges(current_vertex, graph))
{
BOOST_TEST(target_vertices.count(get(boost::vertex_index, graph,
@@ -151,7 +153,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
// Verify adjacent vertices to this vertex
vertices_size_type adjacent_count = 0;
- for (vertex_descriptor adjacent_vertex:
+ BOOST_FOREACH (vertex_descriptor adjacent_vertex,
adjacent_vertices(current_vertex, graph))
{
@@ -166,7 +168,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
// Verify that this vertex is not listed as connected to any
// vertices outside of its adjacent vertices.
- for (vertex_descriptor unconnected_vertex: vertices(graph))
+ BOOST_FOREACH (vertex_descriptor unconnected_vertex, vertices(graph))
{
vertices_size_type unconnected_index
@@ -191,7 +193,7 @@ template < unsigned int Dims > void do_test(minstd_rand& generator)
// Verify all edges are within bounds
edges_size_type edge_count = 0;
- for (edge_descriptor current_edge: edges(graph))
+ BOOST_FOREACH (edge_descriptor current_edge, edges(graph))
{
vertices_size_type source_index
diff --git a/test/incremental_components_test.cpp b/test/incremental_components_test.cpp
index 2d3a10825..df833be9f 100644
--- a/test/incremental_components_test.cpp
+++ b/test/incremental_components_test.cpp
@@ -12,6 +12,7 @@
#include
#include
+#include
#include
#include
#include
@@ -68,19 +69,20 @@ template < typename Graph > void test_graph(const Graph& graph)
// Create a reverse-lookup map for vertex indices
std::vector< vertex_descriptor > reverse_index_map(num_vertices(graph));
- for (vertex_descriptor vertex: vertices(graph))
+ BOOST_FOREACH (vertex_descriptor vertex, vertices(graph))
{
reverse_index_map[get(get(boost::vertex_index, graph), vertex)]
= vertex;
}
// Verify that components are really connected
- for (vertices_size_type component_index: vertex_components)
+ BOOST_FOREACH (vertices_size_type component_index, vertex_components)
{
std::set< vertex_descriptor > component_vertices;
- for (vertices_size_type child_index: vertex_components[component_index])
+ BOOST_FOREACH (
+ vertices_size_type child_index, vertex_components[component_index])
{
vertex_descriptor child_vertex = reverse_index_map[child_index];
@@ -90,7 +92,7 @@ template < typename Graph > void test_graph(const Graph& graph)
// Verify that children are connected to each other in some
// manner, but not to vertices outside their component.
- for (vertex_descriptor child_vertex: component_vertices)
+ BOOST_FOREACH (vertex_descriptor child_vertex, component_vertices)
{
// Skip orphan vertices
@@ -103,7 +105,8 @@ template < typename Graph > void test_graph(const Graph& graph)
// another vertex in the component.
bool edge_exists = false;
- for (edge_descriptor child_edge: out_edges(child_vertex, graph))
+ BOOST_FOREACH (
+ edge_descriptor child_edge, out_edges(child_vertex, graph))
{
if (component_vertices.count(target(child_edge, graph)) > 0)
@@ -159,7 +162,7 @@ int main(int argc, char* argv[])
// Assign indices to list_graph's vertices
graph_traits< ListGraph >::vertices_size_type index = 0;
- for (graph_traits< ListGraph >::vertex_descriptor vertex:
+ BOOST_FOREACH (graph_traits< ListGraph >::vertex_descriptor vertex,
vertices(list_graph))
{
put(get(boost::vertex_index, list_graph), vertex, index++);