On Dec 17, 2006, at 3:07 AM, Silvia Richter wrote:
Douglas Gregor wrote:
On Thu, 2006-12-14 at 04:52 +0000, Silvia Richter wrote:
I call adjacent_vertices() on a vertex A, which gives me an adjacency_iterator. Then I remove all edges from A by calling clear_vertex(). Then I want to use the adjacency_iterator obtained previously to check the new degrees of all (previous) neighbours of the removed vertex v. But the program crashes with a segmentation fault, when I try to use the iterator.
Unfortunately, this won't work. Once you've called clear_vertex(), the data that the adjacency_iterator for that vertex relies on has been removed.
Thanks for that. I have in the meantime posted another comment (you may have seen it), when I experienced that my code works with certain older compilers, but not with newer ones. Looks like that is just coincidence, then (?)
I believe that is just a coincidence. Once the call to clear_vertex() has been made, any use of adjacency_iterator for that vertex is "undefined behavior", which means that it might work on might fail... we just won't know. Cheers, Doug