Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-06-14 13:06:36

On Jun 14, 2005, at 9:44 AM, martin f krafft wrote:
> also sprach Doug Gregor <dgregor_at_[hidden]> [2005.06.14.1558
> +0200]:
>>> g[*ei].fn()
>>> g[*vi].fn()
>>> This is rather awkward. Is there a better way?
>> Not really. If you can come up with a more natural syntax to express
>> what you'd like to do, we can try to incorporate it into the BGL.
> I'll think about it. One trivial way would be to store properties in
> the descriptors, rather than keeping a list of properties indexed by
> descriptor in the graph instance. Has this been considered?

Yes. When bundled properties were originally added, we talked about
allowing property access through "->" on vertex and edge descriptors,
because it would be convenient.

Unfortunately it becomes a const-qualification nightmare. In the BGL
now, descriptors just abstractly name a vertex or edge. To get to a
property, you need to go through the graph (or, more commonly, a
property map). If you have a const graph or property map, you get const
property values; non-const graphs and property maps give non-const
property values. If we put the properties in the descriptors, we need
to have const and non-const descriptors, which then implies const and
non-const versions of vertex_iterator, edge_iterator,
out_edge_iterator, in_edge_iterator, and adjacency_iterator. The
const_iterator/iterator difference in STL containers can get really
annoying; this would be much worse.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at