-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Peter Dimov Sent: Wednesday, October 05, 2005 10:41 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [bind] Member fn has defeated me
BRIDGES Dick wrote:
BRIDGES Dick wrote:
class Bar { typedef void (*pf)(bool);
If you make this
typedef boost::function
pf; [snip]
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.
[...]
I omitted too much of the context, sorry ;-) For
struct X
{ void f(bool b) {} }
the correct thing would be to use boost::bind(&X::f, &x, _1) so that the bool argument from pf (the first input argument is _1 in bind notation) can be passed to X::f.
Works fine now. I don't know why I find boost::bind so mysterious, but I *WILL* learn! Thank you for both the answers and your patience. Regards, Dick