[Boost-bugs] [Boost C++ Libraries] #8714: Allow move-only handlers

Subject: [Boost-bugs] [Boost C++ Libraries] #8714: Allow move-only handlers
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-20 10:42:15

#8714: Allow move-only handlers
 Reporter: Marton <marton78@…> | Owner: chris_kohlhoff
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.53.0 | Severity: Problem
 Keywords: |
 (See also http://stackoverflow.com/questions/17211263)

 The requirement that handlers be copy constructible doesn't allow for the
 following idiom:

 void connection::send_response()
     // block until previous response is sent
     std::unique_lock<std::mutex> locker(response_mutex_);

     // prepare response
     response_ = "foo";

     // send response back to caller. move the unique_lock into the binder
     // to keep the mutex locked until asio is done sending.
                                 _1, _2, std::move(locker))

 void connection::response_sent(const boost::system::error_code& err,
 std::size_t len)
     if (err) handle_error(err);
     // the mutex is unlocked when the binder is destroyed

 Please remove this restriction, there is no reason for it when using

Ticket URL: <https://svn.boost.org/trac/boost/ticket/8714>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC