Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::bind member function and save to function pointer
From: Thomas Heller (thom.heller_at_[hidden])
Date: 2011-04-14 00:44:56

On Thu, Apr 14, 2011 at 1:27 AM, Littlefield, Tyler <tyler_at_[hidden]> wrote:
> Hey, I can finally be of some use, this is cool!
>>    funcPointer = boost::bind(&ChatClient::memberReceiver, this, _1);
> that does not work. what boost::bind is returning in that case is a
> boost::function object, like this:
> boost::function<void (std::string)>; I believe is how you had your message
> receiving function declared. In which case, you will need to declare another
> variable for that.

This seems to be common misconception.

bind does _not_ return a boost::function object. It never did, it
never will. Never.
It returns some type that is callable, thus you can assign it to,
construct a boost::function
object with the right signature from it.

> HTH, and happy hacking!

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at