|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-10-05 12:41:07
BRIDGES Dick wrote:
>> BRIDGES Dick wrote:
>>
>>> class Bar {
>>> typedef void (*pf)(bool);
>>
>> If you make this
>>
>> typedef boost::function<void(bool)> 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.
>
> <error_message>
[...]
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.
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