Boost logo

Boost Users :

From: BRIDGES Dick (Dick.Bridges_at_[hidden])
Date: 2005-10-04 17:35:20


void foo(bool){}

struct X {
  void f(bool b) {}
}

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

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.
  /*LOTS* of other failed attempts with various errors. 8(

  return(0);
}

<error_msg edited=yes instance="one of many">
error: no matching function for call to 'X::x()'
candidates are: void X::x(bool).
</error_msg>

I've been reduced to [shudder] "...trying things." I'm
simply trying to construct one class by passing in a
function pointer (that happes to be a class member).
Could someone point me in the right direction?

Regards,
Dick Bridges


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