|
Boost Users : |
From: Andrew Holden (aholden_at_[hidden])
Date: 2007-10-18 09:43:57
boost-users-bounces_at_[hidden] <> wrote:
> Hello all,
>
> I'm working on implicitly defined graphs using the graph
> boost library. The out_edges function (for example) generates
> the list of out edges on the fly and returns a
> shared_container_iterator. Creating this list takes a
> non-trivial amount of time and so I'd like to cache the
> result of out_edges so that future calls don't duplicate.
>
> But I'm not sure how to do this and still fit within the "BGL
> way." My first instinct was to add the cache as a member of
> the graph. But this means that out_edges has to take a
> non-const reference so that it can update the graph and this
> causes problems for filtered_graph and reverse_graph.
>
> Right now I'm toying with making my cache global and keyed to
> the address of the graph but this seems inelegant.
>
> Anyone have any suggestions?
>
> -krish
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Have you considered making the cache a mutable member of the graph?
This would allow you to update the cache, even if you have a constant
reference to the graph.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net