Here's the 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 the console I see upto "Remove v" and I get the *.exe has stopped working window. So removing the last vertex threw the exception.
When I catch the exception and print it, it says "bad allocation." In my actual program (above I have a simple test program) it says "Caught std::exception: vector too long. Looks like there was a divide by zero for the vector length. Any ideas why this is happening?
Update: I'm using MS VS2010 compiler with boost version 1.51