Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio::asyn_accept handler
From: Christopher Pisz (christopherpisz_at_[hidden])
Date: 2017-03-29 13:07:12


If I change it to
std::function<void(const
            boost::system::error_code &error)> callback = ...

then the connection is not passed. If it is not passed, then there is no
way to store it, change its state, etc.
It is passed in the tutorial code, so why can't I pass it with
std::function?

On Wed, Mar 29, 2017 at 12:56 AM, TONGARI J via Boost-users <
boost-users_at_[hidden]> wrote:

> 2017-03-29 11:28 GMT+08:00 Christopher Pisz via Boost-users <
> boost-users_at_[hidden]>:
>
>> Exact source listing in Visual Studio 2015
>>
>
> [...]
>
>
>> Exact output spew from compilation:
>> This is against boost 1.55, because that's what I have at home. I use
>> 1.62.0 at work and get the exact same errors.
>>
>
> Change
> ```
> std::function<void(tcp_connection::pointer new_connection, const
> boost::system::error_code &error)> callback = ...
> ```
> To:
> ```
> std::function<void(const
> boost::system::error_code &error)> callback = ...
> ```
>
> BTW, I'd recommend using lambda exprs instead of bind in most cases.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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