Boost logo

Boost Users :

Subject: Re: [Boost-users] Why use 'functional composition' with boost::bind
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-08-03 19:56:26

On Tue, Aug 3, 2010 at 12:27 PM, WB <w.brenig_at_[hidden]> wrote:
>> Wolfram Brenig wrote:
>> > -----------------------
>> > Now, my question is, if such nested construction of functors
>> > at the call site, which is suggested also in the 'Bind Summary'
>> > in Karlsson's book, will actually lead to code which has no
>> > relevant performance loss as compared to 'old-style' for-loops?
>> > <snip>
>> >     bind(multiplies<double>(),bind(sin,_1),bind(sin,_1)),
>> >     bind(multiplies<double>(),bind(cos,_1),bind(cos,_1))
>> >
>> These calls to sin and cos are through function pointers.
>> In Christ,
>> Steven Watanabe
> Hi,
> Even if boost::bind does so in this expression, what should I
> conclude from that in the context of my question? Does this
> already make up for the performance difference?
> Can you suggest a different nested bind at the call site for this
> example which performs similar to old-style for-loops (and
> please: by code not by casuistry)

You all really should look at Boost.Phoenix (part of the Boost.Spirit
namespace right now, becoming a full namespace soon), it is designed
for just what you are trying to do, but vastly better, and much more

The documentation to Phoenix2 is at:
And Phoenix3 is coming out soon, but will have the same interface as
Phoenix2, but yet even more capable.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at