|
Boost Users : |
From: Kirit Sælensminde (kirit.saelensminde_at_[hidden])
Date: 2007-10-02 12:30:45
e r wrote:
> hi
> boost::bind(
> &A::f,
> _1
> )
>
> in different parts of my code. how can i define an alias for this
> expression?
>
>
> i'm thinking of using something like
>
> some_type* fo = new boost::bind(&A::f,_1);
>
> and use *fo in place of boost::bind(...). is this crazy? what should
> some_type be?
Normally the easiest thing to do is to put it into a boost::function object.
The correct type depends on the parameter to &A::f and the return type.
Assuming that it is this: R A::f( B ) then something like this should work:
boost::function< R ( B ) > do_f( boost::bind( &A::f, _1 ) );
R my_r = do_f( a_B );
K
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