BGL: using an edge_descriptor as key in a map
Hi, is it possible to use an edge_descriptor (boost::graph_traits<G>::edge_descriptor) as key in a map? I intend to write a visitor class which sets a boolean to each edge, and therefore I need the edge as key. The result of my first try is, that the compiler complains about the missing '<' operator of the key in the map. Best regards Stefan Rauch
On Tuesday 11 May 2004 05:59 am, boost@spyderworks.de wrote:
Hi, is it possible to use an edge_descriptor (boost::graph_traits<G>::edge_descriptor) as key in a map?
In general, no. Edge descriptors can typically only be compared via == and !=. One notable exception is when the edge list type is "vecS" in an adjacent_list, because those edge descriptors can be used as integral types.
I intend to write a visitor class which sets a boolean to each edge, and therefore I need the edge as key.
Common ways to do this include using internal properties and maintaining your own edge_index (internal) property so that you can build property maps out of vectors. Doug
participants (2)
-
boost@spyderworks.de
-
Douglas Gregor