Boost logo

Boost Users :

Subject: Re: [Boost-users] ASIO async_accept() and c++2011 lambas
From: Igor R (boost.lists_at_[hidden])
Date: 2011-07-27 06:42:57


> It is possible t copy the value of error in a lambda external variable?
>
>     const boost::system::error_code myError;
>     acceptor.async_accept(*socket,[&myError] (const
> boost::system::error_code &error)
>                                        {
>                                         myError = error; //???
>                                         } );

Yes, you can capture a global object by reference and modify it (if it
non-const) inside a lambda.
But this is realy out of boost scope. For details, please read the following:
http://msdn.microsoft.com/en-us/library/dd293608.aspx
http://msdn.microsoft.com/en-us/library/dd293603.aspx


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