Boost logo

Boost :

From: Rob Smallshire (robert_at_[hidden])
Date: 2001-07-19 05:20:51


I'm using the Boost graph library at the moment, and just getting the
hang of the vast number of iterator types I have to play with.

With the boost::graph_traits<>::adjacency_iterator(which is
dereferencable to a vertex descriptor), what are the const semantics
(intended and/or implemented) of this iterator ?

Presumably, I can't change the neighbours of a vertex by fiddling
with what the adjacency_iterators returned by adjacent_vertices() are
pointing to ? So is it behaving as a 'const_adjacency_iterator' even
though it doesn't have this name ?

This is important to me because my class (which contains a Boost
graph), needs to be able to return a list of neighbours for a given
vertex. I could copy the list of neighbours into a container and
return a reference to the container, but it would be nicer to just
return the adjacency_iterators to the client code for my class, but I
don't want the client code to be able to modify the data in my class,
so the iterators should be the equivalent of const_iterators.

Thoughts/comments ?

Rob Smallshire


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