[BGL/iterator_adaptor] retrieving edge iterators from a const graph object?

I'm developing an algorithm based on a DFS of a directed graph that models
the BidirectionalGraph concept. In my DFS visitor I have a need to retrieve
the pair of in_edge iterators of a specific vertex in my finish_vertex
method. Invoking boost::in_edges(Vertex, Graph) and discarding the result
compiles fine. However, I can't compile the statement
boost::tie(edgeiniterBegin, edgeiniterEnd) = boost::in_edges(Vertex, Graph).
I'm struggling to understand why the const-ness of the Graph object results
in a "no user defined conversion. from const boost::iterator_adaptor ...."
compilation error.
I suspect that I have incorrectly specified the type of the in-edge
iterators to which I'm attempting to boost::tie the returned iterator pair
(my target iterators are declared as
boost::graph_traits

Hi Chris, It sounds like what you're doing is fine... so I'll have to see the code. Cheers, Jeremy On Monday, August 18, 2003, at 09:51 PM, Chris Russell wrote:
I'm developing an algorithm based on a DFS of a directed graph that models the BidirectionalGraph concept. In my DFS visitor I have a need to retrieve the pair of in_edge iterators of a specific vertex in my finish_vertex method. Invoking boost::in_edges(Vertex, Graph) and discarding the result compiles fine. However, I can't compile the statement boost::tie(edgeiniterBegin, edgeiniterEnd) = boost::in_edges(Vertex, Graph). I'm struggling to understand why the const-ness of the Graph object results in a "no user defined conversion. from const boost::iterator_adaptor ...." compilation error.
I suspect that I have incorrectly specified the type of the in-edge iterators to which I'm attempting to boost::tie the returned iterator pair (my target iterators are declared as boost::graph_traits
::in_edge_iterator currently) but haven't been able to figure out how else to explain my intent to the compiler. I'll post the specific error message produced by the Windows version of the Intel 7.x compiler and source if necessary - but I'm guessing that I'm missing something pretty obvious here. Any clarification/suggestions would be appreciated.
TIA - Chris

Jeremy straightened me out offlist after staring at my code. For the record,
the problem + solution:
... attempting to retrieve the in_edge_iterator pair for a specific vertex
in a directed graph in the context of a DFS visitor - unable to compile
boost::tie(edgeiniterBegin, edgeiniterEnd) = boost::in_edges(Vertex, Graph).
My problem was that I was running the DFS on a reversed copy of my graph and
attempting to boost::tie to iterator typedefs defined not for the reversed
graph, but rather for the unreversed graph;
I had code that looked like:
mygraph_edge_in_iterator_t edgeiniterBegin, edgeiniterEnd; // NO!
boost::tie(edgeiniterBegin, edgeiniterEnd) = boost::in_edges(Vertex, Graph);
Instead:
typename boost::graph_traits
Hi Chris,
It sounds like what you're doing is fine... so I'll have to see the code.
Cheers, Jeremy
participants (2)
-
Chris Russell
-
Jeremy Siek