Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-07-12 10:38:03


James Sutherland:

> I can create the multiply function as
>
> boost::function<double(double,double)> mult(_1*_2);
>
> But now how do I create a "F1" function "h" such that h(t) = f(t)*g(t)?

bind( mult, bind( f, _1 ), bind( g, _1 ) ) creates h(t) = mult( f(t),
g(t) ).

> I want to do something like:
>
> F1 h = bind( mult, f, g, _1 );

This creates h(t) = mult( f, g, t ).

> or
>
> F1 h = bind( mult, bind(f,_1), bind(g,_1), _1 );

This creates h(t) = mult( f(t), g(t), t ). _1 represents the first free
argument, 't' in your notation.


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