|
Boost : |
From: jeremy siek (jsiek_at_[hidden])
Date: 2000-09-19 16:15:07
David Abrahams writes:
> Do you think we could have one of these instead?
>
>
> edge_property<Graph, edge_capacity>::type capacity
> = edge_property(G, edge_capacity());
> edge_property<Graph, edge_flow>::type flow
> = edge_property(G, edge_flow());
As one of the reviewers mentioned, this could be confusing because it
sounds like you are accessing a property value instead of a property
accessor.
> or better yet:
>
> // using static template member functions
> edge_capacity_type<Graph>::type capacity = edge_capacity::get(G);
> edge_flow_type<Graph>::type flow = edge_flow::get(G);
>
> or maybe:
>
> property_traits<Graph, edge_capacity>::type capacity =
> edge_capacity::get(G);
> property_traits<Graph, edge_flow>::type flow = edge_flow::get(G);
Since 'property_traits' is already taken, how about:
property_accessor<Graph, edge_capacity>::type
capacity = accessor(G, edge_capacity());
or if you prefer using a static member function:
property_accessor<Graph, edge_capacity>::type
capacity = edge_capacity::accessor(G);
One caveat to this is that implementing this will require a little
meta-programming to distinguish beteen edge and vertex property tags.
> And then some convenience functions:
>
> edge_capacity::get(G, edge_descriptor) // to get an edge_capacity
> edge_capacity::set(G, edge_descriptor, value) // to set an edge capacity
>
> If you want to call it put(), that's OK too I guess.
I'm not sure why you'd ever want these. The property accessor
interface already handles this:
property_accessor<Graph, edge_capacity>::type
capacity = edge_capacity::accessor(G);
get(capacity, e)
set(capacity, e, c);
Cheers,
Jeremy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk