c++ - Removing the last vertex from a boost graph throws an exception -
here's code i'm using:
typedef boost::adjacency_list<boost::vecs, boost::vecs, boost::bidirectionals> graph; graph g; typedef graph_traits<graph>::vertex_descriptor vertex; typedef graph_traits<graph>::edge_descriptor edge_desc; typedef graph_traits<graph>::vertex_iterator vertex_iterator; vertex u, v; u = boost::add_vertex(g); v = boost::add_vertex(g); edge_desc edge; bool inserted = false; boost::tie(edge,inserted) = boost::add_edge(u,v,g); boost::remove_edge(edge,g); cout<<"\nafter removing edge"<<endl; cout<<"\nremove u"<<endl; boost::remove_vertex(u,g); cout<<"\nremove v"<<endl; boost::remove_vertex(v,g); cout<<"\n!everything removed"<<endl;
in console see upto "remove v" , *.exe has stopped working window. removing last vertex threw exception.
when catch exception , print it, says "bad allocation." in actual program (above have simple test program) says "caught std::exception: vector long. looks there divide 0 vector length. ideas why happening?
update: i'm using ms vs2010 compiler boost version 1.51
Comments
Post a Comment