|
Boost Users : |
From: EJ van Eijk (kojak_at_[hidden])
Date: 2002-07-28 02:10:55
Hello,
I'm currently implementing some algorithms for drawing graphs, using
boost::graph. PropertyMaps e.a. are working like a charm, but for my
algorithm I need to find the adjacent vertices. Now I've become stuck
on the following:
typedef boost::adjacency_list < boost::mapS,
boost::vecS,
boost::undirectedS,
VertexProperty,
EdgeProperty> Graph;
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
class functor {
...
void operator()(Vertex& v) { ... };
};
for_each(adjacent_vertices(u,g).first,
adjacent_vertices(u,g).second,
functor<Graph>(g));
complains about
foo.cc:30: initialization of non-const reference type `Vertex &'
foo.cc:30: from rvalue of type `unsigned int'
But, when using vertices(g) instead of adjacent_vertices(v,g), the
code compiles, and applies functor to each vertex.
What am I missing? The documentation is quite thorough, but I'm lost at the
moment...
EJ
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net