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:

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