Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-10-04 17:49:08


BRIDGES Dick wrote:

> class Bar {
> typedef void (*pf)(bool);

If you make this

    typedef boost::function<void(bool)> pf;

> public:
> Bar(pf fn){
> fn(true);
> }
> };
>
> int main( int argc, char **argv ) {
>
> Bar bar_(foo); // ok.
>
> X x;
> Bar bar_(boost::bind(&X::f, &x)()); // compile fails.

then

  Bar bar_( boost::bind(&X::f, &x) );

should work. But you can't get an oridnary function pointer from
boost::bind; a function pointer doesn't have enough state to represent &X::f
+ &x.


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