Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] Having a cost function as weight map
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2009-12-18 12:56:22


On Fri, 18 Dec 2009, Maxime van Noppen wrote:

> Jeremiah Willcock wrote:
>> Please tell me if there are any problems, as I have not
>> tested this.
>
> It seems to work. I had to do a little fix to your code though. In the
> function_property_map you use 'value_type' which isn't defined and which
> is, I believe :
>
> typedef typename boost::property_traits<
> function_property_map<Functor, Arg>
> >::value_type
> value_type;

OK. It actually should be "typename boost::result_of<Functor(Arg)>::type"
like what is in the specialization of property_traits.

> I also changed the functor type from 'Functor' to 'const Functor&'. It
> seems to work. What was the rationale for copying it ?

In case your operator()() in the functor is non-const (even though I said
I was assuming it was const); switching to a reference is fine.

> My functor needs to have a pointer/reference to the graph to be able to
> get the my_edge object from the edge_descriptor passed to the operator().

OK. Did it work otherwise?

-- Jeremiah Willcock


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