I noticed today that code of this form does not compile:
typedef boost::adjacency_list Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
typedef boost::graph_traits<Graph>::edge_descriptor Edge;
Graph graph = ...;
Vertex vertex = ...;
for (Edge edge: boost::out_edges(vertex, graph)) {...}
The reason is that out_edges returns a std::pair of iterators. This
is a valid range in the sense of boost.range, and so is compatible
with BOOST_FOREACH. However, this is not a valid range in the sense
of c++11 range-based-for.
It's not clear whether this can easily be changed. In a perfect world
these functions should probably return something like
boost::iterator_range which would be compatible with both boost- and
language-level concepts of range-ness. However, the graph
documentation explicitly names the return types of out_edges et. al.
(see [1]) as std::pairs, which eliminates some wiggle room. Is there
an alternate way to address this?
-Gabe
[1] http://www.boost.org/doc/libs/1_53_0/libs/graph/doc/IncidenceGraph.html