Boost logo

Boost Users :

Subject: Re: [Boost-users] Why use 'functional composition' with boost::bind
From: Gaetano Mendola (mendola_at_[hidden])
Date: 2010-08-04 05:46:20


On 08/04/2010 03:02 AM, Mathias Gaunard wrote:
>
>> 2) Then, it is suggested furthermore that if foo()
>> is a (simple?) nested function, say T=double and,
>>
>> double foo(double x) { return 2*x; }
>>
>> then one should do 'functional composition', i.e. create the
>> functor for the previous point 1) by
>>
>> boost::bind(std::multiplies<double>(),2,_1)
>
> Replace all that by just 2*_1

Does it work? I was not able to:

error: no match for ‘operator*’ in ‘2 * boost::lambda::<unnamed>::_1’

Regards
Gaetano Mendola


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