Boost logo

Boost :

Subject: Re: [boost] boost.asio and boost.bind question
From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2012-04-07 10:02:52


On Sat, Apr 7, 2012 at 12:30 AM, Philip Bennefall <philip_at_[hidden]> wrote:
> string final_message="some_data";
> the_client->partner_sync.post( boost::bind( &deliver_message, the_client, the_client->partner, final_message) );
...
>around until the completion handler is invoked? Or does bind take care of this? I keep the buffer around whenever I use the asynchronous sending methods in Boost Asio as this is explicitly stated in the documentation, but is this case the same?
>

Actually, bind forces a copy of all parameters. So yes, you're cool.
If you ever want to actually pass something per reference into bind
you have to use boost::ref or boost::cref respectively.

Cheers,
Stephan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk