On Jul 12, 2005, at 8:52 AM, Jeremy Graham Siek wrote:
Hi Guys,
On Jul 12, 2005, at 8:25 AM, Douglas Gregor wrote:
The major problem here is that you shouldn't be dereferencing vertices(databaseGraph).second, because it is a past-the-end iterator. You could rewrite the loop as:
while (vertices(databaseGraph).first != vertices(databaseGraph).second) { b = *vertices(databaseGraph).first; clear_vertex(b, databaseGraph); remove_vertex(b, databaseGraph); }
But the above loop could also have problems due to vertex iterator invalidation caused by remove_vertex... it depends on the graph used.
? We're not storing any iterators, so there's nothing to invalidate. Granted, the loop is horribly inefficient when VertexListS=vecS, and clear() is better, but this will work. Doug