Skip to content

Commit 856fed7

Browse files
authored
Merge pull request #667 from andreacassioli/use-make_iterator_range-example-csr-example-cpp
use make_iterator_range in csr example
2 parents 7ef6d32 + 43e53a0 commit 856fed7

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎example/csr-example.cpp‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// Andrew Lumsdaine
99

1010
#include <boost/graph/compressed_sparse_row_graph.hpp>
11+
#include <boost/range/iterator_range_core.hpp>
1112
#include <string>
12-
#include <boost/graph/iteration_macros.hpp>
1313
#include <iostream>
1414
#include <fstream>
1515
#include <boost/graph/graphviz.hpp>
@@ -43,15 +43,19 @@ int main()
4343

4444
// Set the URLs of each vertex
4545
int index = 0;
46-
BGL_FORALL_VERTICES(v, g, WebGraph)
47-
g[v].url = urls[index++];
46+
for(const auto v : boost::make_iterator_range(vertices(g)))
47+
{
48+
g[v].url = urls[index++];
49+
}
4850

4951
// Output each of the links
5052
std::cout << "The web graph:" << std::endl;
51-
BGL_FORALL_EDGES(e, g, WebGraph)
52-
std::cout << " " << g[source(e, g)].url << " -> " << g[target(e, g)].url
53-
<< std::endl;
5453

54+
for(const auto& e : boost::make_iterator_range(edges(g)))
55+
{
56+
std::cout << " " << g[source(e, g)].url << " -> " << g[target(e, g)].url
57+
<< std::endl;
58+
}
5559
// Output the graph in DOT format
5660
dynamic_properties dp;
5761
dp.property("label", get(&WebPage::url, g));

0 commit comments

Comments
 (0)