Boost logo

Boost :

From: jeremy siek (jsiek_at_[hidden])
Date: 2000-09-19 16:46:32


David Abrahams writes:
> I don't see the problem here. You _are_ accessing the property... of the
> entire graph! Then you can index the property with the particular edge or
> vertex descriptor (you didn't throw out operator[] for property-accessors,
> did you?) It makes complete sense to me (of course ;)), and I think that
> once you've been exposed to the structure (graph->property->property-value)
> the first time there are fewer constructs to remember.

I'd still feel better if we could work the word 'accessor' into the
interface.

> That's why I suggested using edge_property<Graph, edge_capacity>::type
> I still prefer edge_capacity::get(G) to get the edge_capacity of the entire
> graph.

How about replacing '::type' with '::accessor':

  edge_property<Graph, edge_capacity>::accessor

And for the function, could you live with 'get_accessor'

  edge_capacity::get_accessor(G)

> > get(capacity, e)
> > set(capacity, e, c);
> [I thought you nixed "set"]

Yeah, that was a typo.

> I just want to say
>
> edge_capacity::get(G, e)
> edge_capacity::put(G, e, c)
>
> The more tokens you make people type/read the less usable your library is,
> and the less maintainable your users' code is.

The problem with what you've written above is that it is less generic.
It is nice to be able to use both "interior" and "exterior" property
accessors with a graph algorithm (the interface above only works for
"interior" accessors). For example, you need vertex color to do
breadth_first_search(), but you may not want to keep color around for
the entire lifetime of the graph, a waste of space. So you allocate a
vector, use it as a property accessor in BFS, then deallocate.

Cheers,

Jeremy


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