Boost logo

Boost Users :

From: Cyrille Damez (damez_at_[hidden])
Date: 2004-05-11 11:27:26


Le Mardi 11 Mai 2004 16:50, Douglas Gregor a écrit :

> The iterators won't ever need non-const access to your graph data
> structure. The iterators return edge or vertex descriptors, which do not
> have direct access to the graph data structure. Notice that every operation
> on descriptors includes the graph itself (which can be const or non-const)?
> That's what allows the constness of descriptors to be irrelevant.

So if I understood correctly, I was misunderstanding what a descriptor is
supposed to be. In my particular case, the graph structure is actually a
triangle mesh: the graph vertices are the mesh triangles (resp. the graph
edges are mesh edges) and have non-const access to their edges (resp. the
triangles that contain them).
Therefore, returning non-const iterators that could in turn return descriptors
was conflicting with the constness of the graph.

So if I'm not mistaken, a descriptor should be something like a container for
whatever additional information I am supposed to carry with my graph (here
geometric data like 3D positions, normals, etc.), and shouldn't have the
right to modify anything related to the graph topology. Therefore I should
make all topological informations const in the vertex_descriptor and
edge_descriptor classes and only enable changes to the topology through the
mesh/graph object.

Thanks for the explanation


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