Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-01-30 11:30:17


Jeremy Siek wrote:

> ghost> vector< vertex > alternative_s ;
> ghost> iterator_property_map< vector<vertex>::iterator,
> ghost> property_map<G, vertex_index_t> > alternative = ...
> ghost>
> ghost> The problem is that I have to pass alternative_s.begin() when
> ghost> constructig alternative, but I might want to add new vertices.
> ghost> In that case the iterator can be invalidated.
> ghost>
> ghost> Is there a solution to this problem, except for resorting to internal
> ghost> properties?

> We currenly do not have a solution for this in the BGL (other than
> internal properties). I seem to remember LEDA having a solution for this,
> so you might want to look there for ideas.

Jeremy,
I've sketched some solution which works for me. It's merely a property map,
which uses vector for storage and will resize that vector as needed. I attach
the file. Can you take a look and say if you find the approach reasonable.
I might add it to the property map library in that case.

- Volodya




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk