
7 Apr
2012
7 Apr
'12
2:02 p.m.
On Sat, Apr 7, 2012 at 12:30 AM, Philip Bennefall <philip@blastbay.com> 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