|
Boost Users : |
From: Todd A. Gibson (tgibson_at_[hidden])
Date: 2005-06-03 15:10:41
Hello,
Take this snippet:
// g is an adjacency_list
// u,v are vertices
bool b;
edge_desc e;
tie(e,b)=boost::edge(u,v,g);
if(b==false)
std::cerr << "No such edge!";
boost::edge() is written to handle non-existent vertices:
//abbreviated excerpt from detail/adjacency_list.hpp
inline std::pair<edge_descriptor,bool>
edge_dispatch(...) const
{
bool found;
typename Config::OutEdgeList::const_iterator
i = g.out_edge_list(u).find(StoredEdge(v)),
end = g.out_edge_list(u).end();
found = (i != end);
if (found)
return std::make_pair(edge_descriptor(u, v, &(*i).get_property()),
true);
else
return std::make_pair(edge_descriptor(u, v, 0), false);
}
However, I don't believe out_edge_list handles invalid vertices.
If I provide an invalid source vertex, u, I get a segmentation fault on
the call to g.out_edge_list(u).find(v).
Thanks,
-TAG
Todd A. Gibson
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