Boost Users :
Subject: Re: [Boost-users] [graph] Getting bundled-properties types
From: Juan Antonio Farré Basurte (jafb_at_[hidden])
Date: 2009-03-15 19:05:11
Thanks, Andrew :)
That's a good possible solution, if I want a totally-generic algorithm.
I was considering doing something simmilar at
design time, but finally my design decission was not to be "so" generic
and impose the use of bundled properties. I give default
struct templates for those bundled properties,
but I don't want to impose using that default implementation. So, for a graph accomplishing my
it should always be possible to use the expression g[v].min, but if I use the expression g[v] I don't know the type of the
object it returns.
If there isn't any way to find out that, I'll have no other option than choosing between your totally-generic solution or
to be still more restrictive and impose using my default implementation of the bundled properties the graph must have.
I don't know if I'm
being able to say correctly what I mean (English isn't my native language).
algorithm is generic, you should be thinking about how to "generically"
> get the properties of the graph. You can do this by
abstracting the property
> reference as a function call. Instead of, g[v].min, you should be writing:
> vertex_min(g). Or whatever
'min' actually means in this case.
> What you're doing is effectively defining application-specific semantics for
graph (that vertices have a min property). In order for a graph to model
> that property, you just have to provide an overload specific to
> Andrew Sutton
> Boost-users mailing list
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