11 May
2004
11 May
'04
2:50 p.m.
On Tuesday 11 May 2004 08:29 am, Cyrille Damez wrote:
Am I forced to rely on const_cast in these functions, or is there a way to declare my graph edges, vertices and the corresponding iterators as const in my graph_traits class ?
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. Granted, there are still some graph representations that might need const_casts (or something even uglier). Doug