Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] iterator/descriptor invalidation
From: Julius Ziegler (ziegler_at_[hidden])
Date: 2008-12-10 03:36:54


Dmitry Bufistov <dmitry <at> lsi.upc.edu> writes:

> In the provided example
> g.m_vertices.reserve(6)
> helps.
>

Thanks Dimitry, that is a good idea. In my application I actually have a good
upper bound on the number of vertices that will be added.

It strikes to me now that the matter is not so subtle at all, since add_vertex()
with vecS is very likely to invalidate vertex_iterators (clearly contrary to the
documentation). In my case the issue was a bit obscured since it is not
perfectly clear that source(edge_descriptor) and target(edge_descriptor) use
vertex_iterators. I had expected that edge_descriptor stores two
vertex_descriptors.

So I think the documentation should be updated, should I drop a note at the
developers list?

Regards, Julius


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