Boost logo

Boost Users :

Subject: Re: [Boost-users] [Bind] Unresolved overloaded function type
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2011-08-22 09:41:24


On Sun, Aug 21, 2011 at 8:31 AM, Thomas Heller
<thom.heller_at_[hidden]>wrote:

> On Fri, Aug 19, 2011 at 10:37 AM, Robert Jones <robertgbjones_at_[hidden]>
> wrote:
> > Hi All
> > Can anyone tell me how to fix this? It's fine with one Fedora/Boost
> version
> > combination, but not with another!
>
> Which one would that be?
>
> Possibilities:
> 1) Use boost::bind and cast max to the right function type (ugly):
> bind(static_cast<X(*)(X, X)>(&std::max), ....)
>
> OR
>
> 2) Use boost::phoenix (if you have 1.47 or above):
>
> 2.1) Adapt the max function:
>
> http://www.boost.org/doc/libs/1_47_0/libs/phoenix/doc/html/phoenix/modules/function/adapting_functions.html#phoenix.modules.function.adapting_functions.boost_phoenix_adapt_function
>
> OR
>
> 2.2) Use some shortcut syntax: boost::phoenix::bind<X(X, X)>(&std::max,
> ...)
>
>
Hi Thomas

I'm acutely aware how easily and painlessly Phoenix would solve my problems,
but sadly it
won't be an option for me for quite a while in production code.

In the meantime your suggestion 1 nearly works - I found I needed to write

bind(static_cast<const X &(*)(const X &, const X &)>(&std::max), ....)

Thanks for your help.

- Rob.



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