Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71708 - in trunk: boost/asio boost/asio/detail boost/asio/detail/impl boost/asio/impl boost/asio/ip boost/asio/posix boost/asio/ssl boost/asio/ssl/detail boost/asio/windows libs/asio/example/timers libs/asio/example/tutorial/timer2 libs/asio/test libs/asio/test/ip libs/asio/test/windows
From: chris_at_[hidden]
Date: 2011-05-03 20:02:26


Author: chris_kohlhoff
Date: 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
New Revision: 71708
URL: http://svn.boost.org/trac/boost/changeset/71708

Log:
Updated move support.

Text files modified:
   trunk/boost/asio/basic_datagram_socket.hpp | 22 ++-
   trunk/boost/asio/basic_deadline_timer.hpp | 2
   trunk/boost/asio/basic_raw_socket.hpp | 22 ++-
   trunk/boost/asio/basic_seq_packet_socket.hpp | 9 +
   trunk/boost/asio/basic_serial_port.hpp | 4
   trunk/boost/asio/basic_signal_set.hpp | 2
   trunk/boost/asio/basic_socket.hpp | 6
   trunk/boost/asio/basic_socket_acceptor.hpp | 4
   trunk/boost/asio/basic_stream_socket.hpp | 16 +-
   trunk/boost/asio/connect.hpp | 10 +
   trunk/boost/asio/datagram_socket_service.hpp | 29 +++-
   trunk/boost/asio/deadline_timer_service.hpp | 5
   trunk/boost/asio/detail/bind_handler.hpp | 53 +++++++++
   trunk/boost/asio/detail/config.hpp | 26 +++-
   trunk/boost/asio/detail/deadline_timer_service.hpp | 2
   trunk/boost/asio/detail/handler_invoke_helpers.hpp | 13 ++
   trunk/boost/asio/detail/handler_type_requirements.hpp | 126 ++++++++++++-----------
   trunk/boost/asio/detail/impl/strand_service.hpp | 4
   trunk/boost/asio/detail/impl/task_io_service.hpp | 4
   trunk/boost/asio/detail/impl/win_iocp_io_service.hpp | 4
   trunk/boost/asio/detail/reactive_descriptor_service.hpp | 8
   trunk/boost/asio/detail/reactive_serial_port_service.hpp | 4
   trunk/boost/asio/detail/reactive_socket_service.hpp | 12 +-
   trunk/boost/asio/detail/reactive_socket_service_base.hpp | 12 +-
   trunk/boost/asio/detail/resolver_service.hpp | 4
   trunk/boost/asio/detail/signal_handler.hpp | 4
   trunk/boost/asio/detail/signal_set_service.hpp | 2
   trunk/boost/asio/detail/strand_service.hpp | 4
   trunk/boost/asio/detail/task_io_service.hpp | 4
   trunk/boost/asio/detail/wait_handler.hpp | 4
   trunk/boost/asio/detail/win_iocp_handle_service.hpp | 8
   trunk/boost/asio/detail/win_iocp_io_service.hpp | 4
   trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp | 6
   trunk/boost/asio/detail/win_iocp_serial_port_service.hpp | 4
   trunk/boost/asio/detail/win_iocp_socket_service.hpp | 12 +-
   trunk/boost/asio/detail/win_iocp_socket_service_base.hpp | 12 +-
   trunk/boost/asio/detail/wrapped_handler.hpp | 61 ++++++++++
   trunk/boost/asio/impl/connect.hpp | 83 ++++++++++++---
   trunk/boost/asio/impl/io_service.hpp | 9
   trunk/boost/asio/impl/read.hpp | 156 ++++++++++++++++++++++++----
   trunk/boost/asio/impl/read_at.hpp | 158 +++++++++++++++++++++++++---
   trunk/boost/asio/impl/read_until.hpp | 213 +++++++++++++++++++++++++++++++++++----
   trunk/boost/asio/impl/write.hpp | 178 +++++++++++++++++++++++++++------
   trunk/boost/asio/impl/write_at.hpp | 180 +++++++++++++++++++++++++++-----
   trunk/boost/asio/io_service.hpp | 4
   trunk/boost/asio/ip/basic_resolver.hpp | 6
   trunk/boost/asio/ip/resolver_service.hpp | 12 +
   trunk/boost/asio/posix/basic_stream_descriptor.hpp | 4
   trunk/boost/asio/posix/stream_descriptor_service.hpp | 12 +
   trunk/boost/asio/raw_socket_service.hpp | 29 +++-
   trunk/boost/asio/read.hpp | 10 +
   trunk/boost/asio/read_at.hpp | 11 +
   trunk/boost/asio/read_until.hpp | 32 +----
   trunk/boost/asio/seq_packet_socket_service.hpp | 19 ++-
   trunk/boost/asio/serial_port_service.hpp | 12 +
   trunk/boost/asio/signal_set_service.hpp | 6
   trunk/boost/asio/socket_acceptor_service.hpp | 6
   trunk/boost/asio/ssl/detail/io.hpp | 48 +++++++-
   trunk/boost/asio/ssl/stream.hpp | 20 ++-
   trunk/boost/asio/strand.hpp | 8
   trunk/boost/asio/stream_socket_service.hpp | 18 ++-
   trunk/boost/asio/windows/basic_random_access_handle.hpp | 6
   trunk/boost/asio/windows/basic_stream_handle.hpp | 4
   trunk/boost/asio/windows/overlapped_ptr.hpp | 10 +
   trunk/boost/asio/windows/random_access_handle_service.hpp | 16 +-
   trunk/boost/asio/windows/stream_handle_service.hpp | 12 +
   trunk/boost/asio/write.hpp | 10 +
   trunk/boost/asio/write_at.hpp | 10 +
   trunk/libs/asio/example/timers/tick_count_timer.cpp | 2
   trunk/libs/asio/example/timers/time_t_timer.cpp | 2
   trunk/libs/asio/example/tutorial/timer2/timer.cpp | 2
   trunk/libs/asio/test/buffered_read_stream.cpp | 2
   trunk/libs/asio/test/buffered_stream.cpp | 2
   trunk/libs/asio/test/buffered_write_stream.cpp | 2
   trunk/libs/asio/test/deadline_timer.cpp | 6
   trunk/libs/asio/test/io_service.cpp | 4
   trunk/libs/asio/test/ip/tcp.cpp | 52 +++++----
   trunk/libs/asio/test/ip/udp.cpp | 62 ++++++-----
   trunk/libs/asio/test/serial_port.cpp | 6
   trunk/libs/asio/test/signal_set.cpp | 2
   trunk/libs/asio/test/windows/overlapped_ptr.cpp | 4
   trunk/libs/asio/test/windows/random_access_handle.cpp | 6
   trunk/libs/asio/test/windows/stream_handle.cpp | 6
   83 files changed, 1450 insertions(+), 540 deletions(-)

Modified: trunk/boost/asio/basic_datagram_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_datagram_socket.hpp (original)
+++ trunk/boost/asio/basic_datagram_socket.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -290,7 +290,8 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -331,7 +332,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -468,7 +470,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, WriteHandler handler)
+ const endpoint_type& destination,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -508,7 +511,7 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
       const endpoint_type& destination, socket_base::message_flags flags,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -644,7 +647,8 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -684,7 +688,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -821,7 +826,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, ReadHandler handler)
+ endpoint_type& sender_endpoint,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -863,7 +869,7 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/basic_deadline_timer.hpp
==============================================================================
--- trunk/boost/asio/basic_deadline_timer.hpp (original)
+++ trunk/boost/asio/basic_deadline_timer.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -492,7 +492,7 @@
    * boost::asio::io_service::post().
    */
   template <typename WaitHandler>
- void async_wait(WaitHandler handler)
+ void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WaitHandler.

Modified: trunk/boost/asio/basic_raw_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_raw_socket.hpp (original)
+++ trunk/boost/asio/basic_raw_socket.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -285,7 +285,8 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -325,7 +326,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -462,7 +464,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
- const endpoint_type& destination, WriteHandler handler)
+ const endpoint_type& destination,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -502,7 +505,7 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(const ConstBufferSequence& buffers,
       const endpoint_type& destination, socket_base::message_flags flags,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -638,7 +641,8 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -678,7 +682,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -815,7 +820,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, ReadHandler handler)
+ endpoint_type& sender_endpoint,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -857,7 +863,7 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(const MutableBufferSequence& buffers,
       endpoint_type& sender_endpoint, socket_base::message_flags flags,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/basic_seq_packet_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_seq_packet_socket.hpp (original)
+++ trunk/boost/asio/basic_seq_packet_socket.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -268,7 +268,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -437,7 +438,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags& out_flags, ReadHandler handler)
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -492,7 +494,8 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
       socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, ReadHandler handler)
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/basic_serial_port.hpp
==============================================================================
--- trunk/boost/asio/basic_serial_port.hpp (original)
+++ trunk/boost/asio/basic_serial_port.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -560,7 +560,7 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -671,7 +671,7 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/basic_signal_set.hpp
==============================================================================
--- trunk/boost/asio/basic_signal_set.hpp (original)
+++ trunk/boost/asio/basic_signal_set.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -365,7 +365,7 @@
    * boost::asio::io_service::post().
    */
   template <typename SignalHandler>
- void async_wait(SignalHandler handler)
+ void async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a SignalHandler.

Modified: trunk/boost/asio/basic_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_socket.hpp (original)
+++ trunk/boost/asio/basic_socket.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -698,7 +698,8 @@
    * @endcode
    */
   template <typename ConnectHandler>
- void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler)
+ void async_connect(const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ConnectHandler.
@@ -711,7 +712,8 @@
       if (this->get_service().open(this->get_implementation(), protocol, ec))
       {
         this->get_io_service().post(
- boost::asio::detail::bind_handler(handler, ec));
+ boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), ec));
         return;
       }
     }

Modified: trunk/boost/asio/basic_socket_acceptor.hpp
==============================================================================
--- trunk/boost/asio/basic_socket_acceptor.hpp (original)
+++ trunk/boost/asio/basic_socket_acceptor.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -950,7 +950,7 @@
    */
   template <typename SocketService, typename AcceptHandler>
   void async_accept(basic_socket<protocol_type, SocketService>& peer,
- AcceptHandler handler)
+ BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a AcceptHandler.
@@ -1058,7 +1058,7 @@
    */
   template <typename SocketService, typename AcceptHandler>
   void async_accept(basic_socket<protocol_type, SocketService>& peer,
- endpoint_type& peer_endpoint, AcceptHandler handler)
+ endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a AcceptHandler.

Modified: trunk/boost/asio/basic_stream_socket.hpp
==============================================================================
--- trunk/boost/asio/basic_stream_socket.hpp (original)
+++ trunk/boost/asio/basic_stream_socket.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -303,7 +303,8 @@
    * std::vector.
    */
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_send(const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_send(const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -352,7 +353,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -505,7 +507,8 @@
    * std::vector.
    */
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_receive(const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_receive(const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -556,7 +559,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
@@ -663,7 +667,7 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -774,7 +778,7 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/connect.hpp
==============================================================================
--- trunk/boost/asio/connect.hpp (original)
+++ trunk/boost/asio/connect.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -517,7 +517,7 @@
 template <typename Protocol, typename SocketService,
     typename Iterator, typename ComposedConnectHandler>
 void async_connect(basic_socket<Protocol, SocketService>& s,
- Iterator begin, ComposedConnectHandler handler);
+ Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
 
 /// Asynchronously establishes a socket connection by trying each endpoint in a
 /// sequence.
@@ -586,7 +586,8 @@
 template <typename Protocol, typename SocketService,
     typename Iterator, typename ComposedConnectHandler>
 void async_connect(basic_socket<Protocol, SocketService>& s,
- Iterator begin, Iterator end, ComposedConnectHandler handler);
+ Iterator begin, Iterator end,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
 
 /// Asynchronously establishes a socket connection by trying each endpoint in a
 /// sequence.
@@ -693,7 +694,8 @@
 template <typename Protocol, typename SocketService, typename Iterator,
     typename ConnectCondition, typename ComposedConnectHandler>
 void async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin,
- ConnectCondition connect_condition, ComposedConnectHandler handler);
+ ConnectCondition connect_condition,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
 
 /// Asynchronously establishes a socket connection by trying each endpoint in a
 /// sequence.
@@ -800,7 +802,7 @@
     typename ConnectCondition, typename ComposedConnectHandler>
 void async_connect(basic_socket<Protocol, SocketService>& s,
     Iterator begin, Iterator end, ConnectCondition connect_condition,
- ComposedConnectHandler handler);
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler);
 
 /*@}*/
 

Modified: trunk/boost/asio/datagram_socket_service.hpp
==============================================================================
--- trunk/boost/asio/datagram_socket_service.hpp (original)
+++ trunk/boost/asio/datagram_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -201,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -289,9 +291,11 @@
   /// Start an asynchronous send.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send a datagram to the specified endpoint.
@@ -307,9 +311,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send_to(impl, buffers, destination, flags, handler);
+ service_impl_.async_send_to(impl, buffers, destination, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -325,9 +331,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive a datagram with the endpoint of the sender.
@@ -344,10 +352,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
- handler);
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/deadline_timer_service.hpp
==============================================================================
--- trunk/boost/asio/deadline_timer_service.hpp (original)
+++ trunk/boost/asio/deadline_timer_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -131,9 +131,10 @@
 
   // Start an asynchronous wait on the timer.
   template <typename WaitHandler>
- void async_wait(implementation_type& impl, WaitHandler handler)
+ void async_wait(implementation_type& impl,
+ BOOST_ASIO_MOVE_ARG(WaitHandler) handler)
   {
- service_impl_.async_wait(impl, handler);
+ service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/detail/bind_handler.hpp
==============================================================================
--- trunk/boost/asio/detail/bind_handler.hpp (original)
+++ trunk/boost/asio/detail/bind_handler.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -73,6 +73,14 @@
 }
 
 template <typename Function, typename Handler, typename Arg1>
+inline void asio_handler_invoke(Function& function,
+ binder1<Handler, Arg1>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1>
 inline void asio_handler_invoke(const Function& function,
     binder1<Handler, Arg1>* this_handler)
 {
@@ -81,7 +89,7 @@
 }
 
 template <typename Handler, typename Arg1>
-inline binder1<Handler, Arg1> bind_handler(const Handler& handler,
+inline binder1<Handler, Arg1> bind_handler(Handler handler,
     const Arg1& arg1)
 {
   return binder1<Handler, Arg1>(handler, arg1);
@@ -139,6 +147,14 @@
 }
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2>
+inline void asio_handler_invoke(Function& function,
+ binder2<Handler, Arg1, Arg2>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2>
 inline void asio_handler_invoke(const Function& function,
     binder2<Handler, Arg1, Arg2>* this_handler)
 {
@@ -147,7 +163,7 @@
 }
 
 template <typename Handler, typename Arg1, typename Arg2>
-inline binder2<Handler, Arg1, Arg2> bind_handler(const Handler& handler,
+inline binder2<Handler, Arg1, Arg2> bind_handler(Handler handler,
     const Arg1& arg1, const Arg2& arg2)
 {
   return binder2<Handler, Arg1, Arg2>(handler, arg1, arg2);
@@ -212,6 +228,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3>
+inline void asio_handler_invoke(Function& function,
+ binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3>
 inline void asio_handler_invoke(const Function& function,
     binder3<Handler, Arg1, Arg2, Arg3>* this_handler)
 {
@@ -220,7 +245,7 @@
 }
 
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3>
-inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(const Handler& handler,
+inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(Handler handler,
     const Arg1& arg1, const Arg2& arg2, const Arg3& arg3)
 {
   return binder3<Handler, Arg1, Arg2, Arg3>(handler, arg1, arg2, arg3);
@@ -292,6 +317,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3, typename Arg4>
+inline void asio_handler_invoke(Function& function,
+ binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3, typename Arg4>
 inline void asio_handler_invoke(const Function& function,
     binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler)
 {
@@ -302,7 +336,7 @@
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3,
     typename Arg4>
 inline binder4<Handler, Arg1, Arg2, Arg3, Arg4> bind_handler(
- const Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ Handler handler, const Arg1& arg1, const Arg2& arg2,
     const Arg3& arg3, const Arg4& arg4)
 {
   return binder4<Handler, Arg1, Arg2, Arg3, Arg4>(handler, arg1, arg2, arg3,
@@ -379,6 +413,15 @@
 
 template <typename Function, typename Handler, typename Arg1, typename Arg2,
     typename Arg3, typename Arg4, typename Arg5>
+inline void asio_handler_invoke(Function& function,
+ binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Handler, typename Arg1, typename Arg2,
+ typename Arg3, typename Arg4, typename Arg5>
 inline void asio_handler_invoke(const Function& function,
     binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler)
 {
@@ -389,7 +432,7 @@
 template <typename Handler, typename Arg1, typename Arg2, typename Arg3,
     typename Arg4, typename Arg5>
 inline binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5> bind_handler(
- const Handler& handler, const Arg1& arg1, const Arg2& arg2,
+ Handler handler, const Arg1& arg1, const Arg2& arg2,
     const Arg3& arg3, const Arg4& arg4, const Arg5& arg5)
 {
   return binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>(handler, arg1, arg2,

Modified: trunk/boost/asio/detail/config.hpp
==============================================================================
--- trunk/boost/asio/detail/config.hpp (original)
+++ trunk/boost/asio/detail/config.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -52,20 +52,34 @@
 # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
 # if defined(__GXX_EXPERIMENTAL_CXX0X__)
 # define BOOST_ASIO_HAS_MOVE
+# define BOOST_ASIO_MOVE_ARG(type) type&&
 # define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
 # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
 # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
 # endif // defined(__GNUC__)
-# if defined(BOOST_MSVC)
-# if (_MSC_VER >= 1600)
-# define BOOST_ASIO_HAS_MOVE
-# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
-# endif // (_MSC_VER >= 1600)
-# endif // defined(BOOST_MSVC)
 #endif // !defined(BOOST_ASIO_DISABLE_MOVE)
 
 // If BOOST_ASIO_MOVE_CAST isn't defined yet use a C++03 compatible version.
+// Note that older g++ and MSVC versions don't like it when you pass a
+// non-member function through a const reference, so for most compilers we'll
+// play it safe and stick with the old approach of passing the handler by
+// value.
 #if !defined(BOOST_ASIO_MOVE_CAST)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# define BOOST_ASIO_MOVE_ARG(type) const type&
+# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# elif defined(BOOST_MSVC)
+# if (_MSC_VER >= 1400)
+# define BOOST_ASIO_MOVE_ARG(type) const type&
+# else // (_MSC_VER >= 1400)
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif // (_MSC_VER >= 1400)
+# else
+# define BOOST_ASIO_MOVE_ARG(type) type
+# endif
 # define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
 #endif // !defined_BOOST_ASIO_MOVE_CAST
 

Modified: trunk/boost/asio/detail/deadline_timer_service.hpp
==============================================================================
--- trunk/boost/asio/detail/deadline_timer_service.hpp (original)
+++ trunk/boost/asio/detail/deadline_timer_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -178,7 +178,7 @@
 
   // Start an asynchronous wait on the timer.
   template <typename Handler>
- void async_wait(implementation_type& impl, Handler& handler)
+ void async_wait(implementation_type& impl, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef wait_handler<Handler> op;

Modified: trunk/boost/asio/detail/handler_invoke_helpers.hpp
==============================================================================
--- trunk/boost/asio/detail/handler_invoke_helpers.hpp (original)
+++ trunk/boost/asio/detail/handler_invoke_helpers.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -28,6 +28,19 @@
 namespace boost_asio_handler_invoke_helpers {
 
 template <typename Function, typename Context>
+inline void invoke(Function& function, Context& context)
+{
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
+ || BOOST_WORKAROUND(__GNUC__, < 3)
+ Function tmp(function);
+ tmp();
+#else
+ using namespace boost::asio;
+ asio_handler_invoke(function, boost::addressof(context));
+#endif
+}
+
+template <typename Function, typename Context>
 inline void invoke(const Function& function, Context& context)
 {
 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \

Modified: trunk/boost/asio/detail/handler_type_requirements.hpp
==============================================================================
--- trunk/boost/asio/detail/handler_type_requirements.hpp (original)
+++ trunk/boost/asio/detail/handler_type_requirements.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -17,10 +17,6 @@
 
 #include <boost/asio/detail/config.hpp>
 
-namespace boost {
-namespace asio {
-namespace detail {
-
 // Older versions of gcc have difficulty compiling the sizeof expressions where
 // we test the handler type requirements. We'll disable checking of handler type
 // requirements for those compilers, but otherwise enable it by default.
@@ -48,36 +44,43 @@
 # endif // defined(BOOST_MSVC)
 #endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS)
 
+namespace boost {
+namespace asio {
+namespace detail {
+
 #if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS)
 
 # if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
 
 template <typename Handler>
-auto zero_arg_handler_test(Handler* h)
+auto zero_arg_handler_test(Handler h, void*)
   -> decltype(
- sizeof(Handler(*static_cast<const Handler*>(h))),
- ((*h)()),
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)()),
     char(0));
 
-char (&zero_arg_handler_test(...))[2];
+template <typename Handler>
+char (&zero_arg_handler_test(Handler, ...))[2];
 
 template <typename Handler, typename Arg1>
-auto one_arg_handler_test(Handler* h, Arg1* a1)
+auto one_arg_handler_test(Handler h, Arg1* a1)
   -> decltype(
- sizeof(Handler(*static_cast<const Handler*>(h))),
- ((*h)(*a1)),
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)(*a1)),
     char(0));
 
-char (&one_arg_handler_test(...))[2];
+template <typename Handler>
+char (&one_arg_handler_test(Handler h, ...))[2];
 
 template <typename Handler, typename Arg1, typename Arg2>
-auto two_arg_handler_test(Handler* h, Arg1* a1, Arg2* a2)
+auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2)
   -> decltype(
- sizeof(Handler(*static_cast<const Handler*>(h))),
- ((*h)(*a1, *a2)),
+ sizeof(Handler(static_cast<const Handler&>(h))),
+ ((h)(*a1, *a2)),
     char(0));
 
-char (&two_arg_handler_test(...))[2];
+template <typename Handler>
+char (&two_arg_handler_test(Handler, ...))[2];
 
 # define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \
      static_assert(expr, msg);
@@ -89,6 +92,9 @@
 # endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT)
 
 template <typename T> T& lvref();
+template <typename T> T& lvref(T);
+template <typename T> const T& clvref(T);
+template <typename T> char argbyv(T);
 
 template <int>
 struct handler_type_requirements
@@ -100,15 +106,15 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::zero_arg_handler_test( \
- static_cast<handler_type*>(0))) == 1, \
+ handler, 0)) == 1, \
       "CompletionHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler(), \
+ boost::asio::detail::lvref(handler)(), \
         char(0))>
 
 #define BOOST_ASIO_READ_HANDLER_CHECK( \
@@ -116,17 +122,17 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::two_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0), \
           static_cast<const std::size_t*>(0))) == 1, \
       "ReadHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>(), \
           boost::asio::detail::lvref<const std::size_t>()), \
         char(0))>
@@ -136,17 +142,17 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::two_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0), \
           static_cast<const std::size_t*>(0))) == 1, \
       "WriteHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>(), \
           boost::asio::detail::lvref<const std::size_t>()), \
         char(0))>
@@ -156,16 +162,16 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::one_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0))) == 1, \
       "AcceptHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>()), \
         char(0))>
 
@@ -174,16 +180,16 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::one_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0))) == 1, \
       "ConnectHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>()), \
         char(0))>
 
@@ -192,17 +198,17 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::two_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0), \
           static_cast<const iter_type*>(0))) == 1, \
       "ComposedConnectHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>(), \
           boost::asio::detail::lvref<const iter_type>()), \
         char(0))>
@@ -212,17 +218,17 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::two_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0), \
           static_cast<const iter_type*>(0))) == 1, \
       "ResolveHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>(), \
           boost::asio::detail::lvref<const iter_type>()), \
         char(0))>
@@ -232,16 +238,16 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::one_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0))) == 1, \
       "WaitHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>()), \
         char(0))>
 
@@ -250,17 +256,17 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::two_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0), \
           static_cast<const int*>(0))) == 1, \
       "SignalHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>(), \
           boost::asio::detail::lvref<const int>()), \
         char(0))>
@@ -270,16 +276,16 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::one_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0))) == 1, \
       "HandshakeHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>()), \
         char(0))>
 
@@ -288,16 +294,16 @@
   \
   BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \
       sizeof(boost::asio::detail::one_arg_handler_test( \
- static_cast<handler_type*>(0), \
+ handler, \
           static_cast<const boost::system::error_code*>(0))) == 1, \
       "ShutdownHandler type requirements not met") \
   \
   typedef boost::asio::detail::handler_type_requirements< \
       sizeof( \
- handler_type( \
- static_cast<const handler_type&>(handler))) + \
+ boost::asio::detail::argbyv( \
+ boost::asio::detail::clvref(handler))) + \
       sizeof( \
- handler( \
+ boost::asio::detail::lvref(handler)( \
           boost::asio::detail::lvref<const boost::system::error_code>()), \
         char(0))>
 

Modified: trunk/boost/asio/detail/impl/strand_service.hpp
==============================================================================
--- trunk/boost/asio/detail/impl/strand_service.hpp (original)
+++ trunk/boost/asio/detail/impl/strand_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -56,7 +56,7 @@
 
 template <typename Handler>
 void strand_service::dispatch(strand_service::implementation_type& impl,
- Handler& handler)
+ Handler handler)
 {
   // If we are already in the strand then the handler can run immediately.
   if (call_stack<strand_impl>::contains(impl))
@@ -114,7 +114,7 @@
 // Request the io_service to invoke the given handler and return immediately.
 template <typename Handler>
 void strand_service::post(strand_service::implementation_type& impl,
- Handler& handler)
+ Handler handler)
 {
   // Allocate and construct an operation to wrap the handler.
   typedef completion_handler<Handler> op;

Modified: trunk/boost/asio/detail/impl/task_io_service.hpp
==============================================================================
--- trunk/boost/asio/detail/impl/task_io_service.hpp (original)
+++ trunk/boost/asio/detail/impl/task_io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -28,7 +28,7 @@
 namespace detail {
 
 template <typename Handler>
-void task_io_service::dispatch(Handler& handler)
+void task_io_service::dispatch(Handler handler)
 {
   if (call_stack<task_io_service>::contains(this))
   {
@@ -52,7 +52,7 @@
 }
 
 template <typename Handler>
-void task_io_service::post(Handler& handler)
+void task_io_service::post(Handler handler)
 {
   // Allocate and construct an operation to wrap the handler.
   typedef completion_handler<Handler> op;

Modified: trunk/boost/asio/detail/impl/win_iocp_io_service.hpp
==============================================================================
--- trunk/boost/asio/detail/impl/win_iocp_io_service.hpp (original)
+++ trunk/boost/asio/detail/impl/win_iocp_io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -32,7 +32,7 @@
 namespace detail {
 
 template <typename Handler>
-void win_iocp_io_service::dispatch(Handler& handler)
+void win_iocp_io_service::dispatch(Handler handler)
 {
   if (call_stack<win_iocp_io_service>::contains(this))
   {
@@ -56,7 +56,7 @@
 }
 
 template <typename Handler>
-void win_iocp_io_service::post(Handler& handler)
+void win_iocp_io_service::post(Handler handler)
 {
   // Allocate and construct an operation to wrap the handler.
   typedef completion_handler<Handler> op;

Modified: trunk/boost/asio/detail/reactive_descriptor_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_descriptor_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_descriptor_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -186,7 +186,7 @@
   // lifetime of the asynchronous operation.
   template <typename ConstBufferSequence, typename Handler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef descriptor_write_op<ConstBufferSequence, Handler> op;
@@ -206,7 +206,7 @@
   // Start an asynchronous wait until data can be written without blocking.
   template <typename Handler>
   void async_write_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
+ const null_buffers&, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;
@@ -248,7 +248,7 @@
   // valid for the lifetime of the asynchronous operation.
   template <typename MutableBufferSequence, typename Handler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef descriptor_read_op<MutableBufferSequence, Handler> op;
@@ -268,7 +268,7 @@
   // Wait until data can be read without blocking.
   template <typename Handler>
   void async_read_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
+ const null_buffers&, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;

Modified: trunk/boost/asio/detail/reactive_serial_port_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_serial_port_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_serial_port_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -158,7 +158,7 @@
   // lifetime of the asynchronous operation.
   template <typename ConstBufferSequence, typename Handler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler handler)
   {
     descriptor_service_.async_write_some(impl, buffers, handler);
   }
@@ -175,7 +175,7 @@
   // valid for the lifetime of the asynchronous operation.
   template <typename MutableBufferSequence, typename Handler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler handler)
   {
     descriptor_service_.async_read_some(impl, buffers, handler);
   }

Modified: trunk/boost/asio/detail/reactive_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service.hpp (original)
+++ trunk/boost/asio/detail/reactive_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -215,7 +215,7 @@
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers,
       const endpoint_type& destination, socket_base::message_flags flags,
- Handler& handler)
+ Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_sendto_op<ConstBufferSequence,
@@ -234,7 +234,7 @@
   // Start an asynchronous wait until data can be sent without blocking.
   template <typename Handler>
   void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
+ const endpoint_type&, socket_base::message_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;
@@ -292,7 +292,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_recvfrom_op<MutableBufferSequence,
@@ -318,7 +318,7 @@
   template <typename Handler>
   void async_receive_from(implementation_type& impl,
       const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;
@@ -373,7 +373,7 @@
   // must be valid until the accept's handler is invoked.
   template <typename Socket, typename Handler>
   void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
+ endpoint_type* peer_endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_accept_op<Socket, Protocol, Handler> op;
@@ -401,7 +401,7 @@
   // Start an asynchronous connect.
   template <typename Handler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
+ const endpoint_type& peer_endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_connect_op<Handler> op;

Modified: trunk/boost/asio/detail/reactive_socket_service_base.hpp
==============================================================================
--- trunk/boost/asio/detail/reactive_socket_service_base.hpp (original)
+++ trunk/boost/asio/detail/reactive_socket_service_base.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -198,7 +198,7 @@
   template <typename ConstBufferSequence, typename Handler>
   void async_send(base_implementation_type& impl,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_send_op<ConstBufferSequence, Handler> op;
@@ -219,7 +219,7 @@
   // Start an asynchronous wait until data can be sent without blocking.
   template <typename Handler>
   void async_send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;
@@ -263,7 +263,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive(base_implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_recv_op<MutableBufferSequence, Handler> op;
@@ -287,7 +287,7 @@
   // Wait until data can be received without blocking.
   template <typename Handler>
   void async_receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;
@@ -341,7 +341,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive_with_flags(base_implementation_type& impl,
       const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op;
@@ -364,7 +364,7 @@
   template <typename Handler>
   void async_receive_with_flags(base_implementation_type& impl,
       const null_buffers&, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_null_buffers_op<Handler> op;

Modified: trunk/boost/asio/detail/resolver_service.hpp
==============================================================================
--- trunk/boost/asio/detail/resolver_service.hpp (original)
+++ trunk/boost/asio/detail/resolver_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -68,7 +68,7 @@
   // Asynchronously resolve a query to a list of entries.
   template <typename Handler>
   void async_resolve(implementation_type& impl,
- const query_type& query, Handler& handler)
+ const query_type& query, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef resolve_op<Protocol, Handler> op;
@@ -100,7 +100,7 @@
   // Asynchronously resolve an endpoint to a list of entries.
   template <typename Handler>
   void async_resolve(implementation_type& impl,
- const endpoint_type& endpoint, Handler& handler)
+ const endpoint_type& endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef resolve_endpoint_op<Protocol, Handler> op;

Modified: trunk/boost/asio/detail/signal_handler.hpp
==============================================================================
--- trunk/boost/asio/detail/signal_handler.hpp (original)
+++ trunk/boost/asio/detail/signal_handler.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -33,9 +33,9 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler);
 
- signal_handler(Handler h)
+ signal_handler(Handler& h)
     : signal_op(&signal_handler::do_complete),
- handler_(h)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
   {
   }
 

Modified: trunk/boost/asio/detail/signal_set_service.hpp
==============================================================================
--- trunk/boost/asio/detail/signal_set_service.hpp (original)
+++ trunk/boost/asio/detail/signal_set_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -144,7 +144,7 @@
 
   // Start an asynchronous operation to wait for a signal to be delivered.
   template <typename Handler>
- void async_wait(implementation_type& impl, Handler& handler)
+ void async_wait(implementation_type& impl, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef signal_handler<Handler> op;

Modified: trunk/boost/asio/detail/strand_service.hpp
==============================================================================
--- trunk/boost/asio/detail/strand_service.hpp (original)
+++ trunk/boost/asio/detail/strand_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -80,11 +80,11 @@
 
   // Request the io_service to invoke the given handler.
   template <typename Handler>
- void dispatch(implementation_type& impl, Handler& handler);
+ void dispatch(implementation_type& impl, Handler handler);
 
   // Request the io_service to invoke the given handler and return immediately.
   template <typename Handler>
- void post(implementation_type& impl, Handler& handler);
+ void post(implementation_type& impl, Handler handler);
 
 private:
   BOOST_ASIO_DECL static void do_complete(io_service_impl* owner,

Modified: trunk/boost/asio/detail/task_io_service.hpp
==============================================================================
--- trunk/boost/asio/detail/task_io_service.hpp (original)
+++ trunk/boost/asio/detail/task_io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -88,11 +88,11 @@
 
   // Request invocation of the given handler.
   template <typename Handler>
- void dispatch(Handler& handler);
+ void dispatch(Handler handler);
 
   // Request invocation of the given handler and return immediately.
   template <typename Handler>
- void post(Handler& handler);
+ void post(Handler handler);
 
   // Request invocation of the given operation and return immediately. Assumes
   // that work_started() has not yet been called for the operation.

Modified: trunk/boost/asio/detail/wait_handler.hpp
==============================================================================
--- trunk/boost/asio/detail/wait_handler.hpp (original)
+++ trunk/boost/asio/detail/wait_handler.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -33,9 +33,9 @@
 public:
   BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler);
 
- wait_handler(Handler h)
+ wait_handler(Handler& h)
     : timer_op(&wait_handler::do_complete),
- handler_(h)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
   {
   }
 

Modified: trunk/boost/asio/detail/win_iocp_handle_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_handle_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_handle_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -143,7 +143,7 @@
   // lifetime of the asynchronous operation.
   template <typename ConstBufferSequence, typename Handler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op;
@@ -164,7 +164,7 @@
   // must be valid for the lifetime of the asynchronous operation.
   template <typename ConstBufferSequence, typename Handler>
   void async_write_some_at(implementation_type& impl, boost::uint64_t offset,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op;
@@ -205,7 +205,7 @@
   // valid for the lifetime of the asynchronous operation.
   template <typename MutableBufferSequence, typename Handler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op;
@@ -227,7 +227,7 @@
   // operation.
   template <typename MutableBufferSequence, typename Handler>
   void async_read_some_at(implementation_type& impl, boost::uint64_t offset,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op;

Modified: trunk/boost/asio/detail/win_iocp_io_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_io_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -104,11 +104,11 @@
 
   // Request invocation of the given handler.
   template <typename Handler>
- void dispatch(Handler& handler);
+ void dispatch(Handler handler);
 
   // Request invocation of the given handler and return immediately.
   template <typename Handler>
- void post(Handler& handler);
+ void post(Handler handler);
 
   // Request invocation of the given operation and return immediately. Assumes
   // that work_started() has not yet been called for the operation.

Modified: trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_overlapped_ptr.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -47,11 +47,11 @@
   // Construct an win_iocp_overlapped_ptr to contain the specified handler.
   template <typename Handler>
   explicit win_iocp_overlapped_ptr(
- boost::asio::io_service& io_service, Handler& handler)
+ boost::asio::io_service& io_service, BOOST_ASIO_MOVE_ARG(Handler) handler)
     : ptr_(0),
       iocp_service_(0)
   {
- this->reset(io_service, handler);
+ this->reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler));
   }
 
   // Destructor automatically frees the OVERLAPPED object unless released.
@@ -75,7 +75,7 @@
   // Reset to contain the specified handler, freeing any current OVERLAPPED
   // object.
   template <typename Handler>
- void reset(boost::asio::io_service& io_service, Handler& handler)
+ void reset(boost::asio::io_service& io_service, Handler handler)
   {
     typedef win_iocp_overlapped_op<Handler> op;
     typename op::ptr p = { boost::addressof(handler),

Modified: trunk/boost/asio/detail/win_iocp_serial_port_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_serial_port_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_serial_port_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -153,7 +153,7 @@
   // lifetime of the asynchronous operation.
   template <typename ConstBufferSequence, typename Handler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler handler)
   {
     handle_service_.async_write_some(impl, buffers, handler);
   }
@@ -170,7 +170,7 @@
   // valid for the lifetime of the asynchronous operation.
   template <typename MutableBufferSequence, typename Handler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler handler)
   {
     handle_service_.async_read_some(impl, buffers, handler);
   }

Modified: trunk/boost/asio/detail/win_iocp_socket_service.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_socket_service.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -291,7 +291,7 @@
   template <typename ConstBufferSequence, typename Handler>
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op;
@@ -314,7 +314,7 @@
   // Start an asynchronous wait until data can be sent without blocking.
   template <typename Handler>
   void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
+ const endpoint_type&, socket_base::message_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_null_buffers_op<Handler> op;
@@ -372,7 +372,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endp,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_recvfrom_op<
@@ -396,7 +396,7 @@
   template <typename Handler>
   void async_receive_from(implementation_type& impl,
       const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_null_buffers_op<Handler> op;
@@ -448,7 +448,7 @@
   // must be valid until the accept's handler is invoked.
   template <typename Socket, typename Handler>
   void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
+ endpoint_type* peer_endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_accept_op<Socket, protocol_type, Handler> op;
@@ -481,7 +481,7 @@
   // Start an asynchronous connect.
   template <typename Handler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
+ const endpoint_type& peer_endpoint, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef reactive_socket_connect_op<Handler> op;

Modified: trunk/boost/asio/detail/win_iocp_socket_service_base.hpp
==============================================================================
--- trunk/boost/asio/detail/win_iocp_socket_service_base.hpp (original)
+++ trunk/boost/asio/detail/win_iocp_socket_service_base.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -216,7 +216,7 @@
   template <typename ConstBufferSequence, typename Handler>
   void async_send(base_implementation_type& impl,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op;
@@ -239,7 +239,7 @@
   // Start an asynchronous wait until data can be sent without blocking.
   template <typename Handler>
   void async_send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_null_buffers_op<Handler> op;
@@ -283,7 +283,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive(base_implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_recv_op<MutableBufferSequence, Handler> op;
@@ -306,7 +306,7 @@
   // Wait until data can be received without blocking.
   template <typename Handler>
   void async_receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_null_buffers_op<Handler> op;
@@ -357,7 +357,7 @@
   template <typename MutableBufferSequence, typename Handler>
   void async_receive_with_flags(base_implementation_type& impl,
       const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op;
@@ -380,7 +380,7 @@
   template <typename Handler>
   void async_receive_with_flags(base_implementation_type& impl,
       const null_buffers&, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler handler)
   {
     // Allocate and construct an operation to wrap the handler.
     typedef win_iocp_null_buffers_op<Handler> op;

Modified: trunk/boost/asio/detail/wrapped_handler.hpp
==============================================================================
--- trunk/boost/asio/detail/wrapped_handler.hpp (original)
+++ trunk/boost/asio/detail/wrapped_handler.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -31,12 +31,26 @@
 public:
   typedef void result_type;
 
- wrapped_handler(Dispatcher dispatcher, const Handler& handler)
+ wrapped_handler(Dispatcher dispatcher, Handler& handler)
     : dispatcher_(dispatcher),
- handler_(handler)
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ wrapped_handler(const wrapped_handler& other)
+ : dispatcher_(other.dispatcher_),
+ handler_(other.handler_)
+ {
+ }
+
+ wrapped_handler(wrapped_handler&& other)
+ : dispatcher_(other.dispatcher_),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   void operator()()
   {
     dispatcher_.dispatch(handler_);
@@ -126,11 +140,31 @@
 class rewrapped_handler
 {
 public:
+ explicit rewrapped_handler(Handler& handler, const Context& context)
+ : context_(context),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ {
+ }
+
   explicit rewrapped_handler(const Handler& handler, const Context& context)
- : handler_(handler),
- context_(context)
+ : context_(context),
+ handler_(handler)
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ rewrapped_handler(const rewrapped_handler& other)
+ : context_(other.context_),
+ handler_(other.handler_)
+ {
+ }
+
+ rewrapped_handler(rewrapped_handler&& other)
+ : context_(BOOST_ASIO_MOVE_CAST(Context)(other.context_)),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
   {
   }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
 
   void operator()()
   {
@@ -143,8 +177,8 @@
   }
 
 //private:
- Handler handler_;
   Context context_;
+ Handler handler_;
 };
 
 template <typename Dispatcher, typename Handler>
@@ -164,6 +198,15 @@
 }
 
 template <typename Function, typename Dispatcher, typename Handler>
+inline void asio_handler_invoke(Function& function,
+ wrapped_handler<Dispatcher, Handler>* this_handler)
+{
+ this_handler->dispatcher_.dispatch(
+ rewrapped_handler<Function, Handler>(
+ function, this_handler->handler_));
+}
+
+template <typename Function, typename Dispatcher, typename Handler>
 inline void asio_handler_invoke(const Function& function,
     wrapped_handler<Dispatcher, Handler>* this_handler)
 {
@@ -189,6 +232,14 @@
 }
 
 template <typename Function, typename Handler, typename Context>
+inline void asio_handler_invoke(Function& function,
+ rewrapped_handler<Handler, Context>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->context_);
+}
+
+template <typename Function, typename Handler, typename Context>
 inline void asio_handler_invoke(const Function& function,
     rewrapped_handler<Handler, Context>* this_handler)
 {

Modified: trunk/boost/asio/impl/connect.hpp
==============================================================================
--- trunk/boost/asio/impl/connect.hpp (original)
+++ trunk/boost/asio/impl/connect.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -188,6 +188,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ connect_op(const connect_op& other)
+ : base_from_connect_condition<ConnectCondition>(other),
+ socket_(other.socket_),
+ iter_(other.iter_),
+ end_(other.end_),
+ handler_(other.handler_)
+ {
+ }
+
+ connect_op(connect_op&& other)
+ : base_from_connect_condition<ConnectCondition>(other),
+ socket_(other.socket_),
+ iter_(other.iter_),
+ end_(other.end_),
+ handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(boost::system::error_code ec, int start = 0)
     {
       switch (start)
@@ -200,7 +220,8 @@
           if (iter_ != end_)
           {
             socket_.close(ec);
- socket_.async_connect(*iter_, *this);
+ socket_.async_connect(*iter_,
+ BOOST_ASIO_MOVE_CAST(connect_op)(*this));
             return;
           }
 
@@ -263,6 +284,17 @@
   template <typename Function, typename Protocol,
       typename SocketService, typename Iterator,
       typename ConnectCondition, typename ComposedConnectHandler>
+ inline void asio_handler_invoke(Function& function,
+ connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Protocol,
+ typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
   inline void asio_handler_invoke(const Function& function,
       connect_op<Protocol, SocketService, Iterator,
         ConnectCondition, ComposedConnectHandler>* this_handler)
@@ -270,37 +302,52 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename Protocol, typename SocketService, typename Iterator,
+ typename ConnectCondition, typename ComposedConnectHandler>
+ inline connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>
+ make_connect_op(basic_socket<Protocol, SocketService>& sock,
+ const Iterator& begin, const Iterator& end,
+ const ConnectCondition& connect_condition,
+ ComposedConnectHandler handler)
+ {
+ return connect_op<Protocol, SocketService, Iterator,
+ ConnectCondition, ComposedConnectHandler>(
+ sock, begin, end, connect_condition, handler);
+ }
 } // namespace detail
 
 template <typename Protocol, typename SocketService,
     typename Iterator, typename ComposedConnectHandler>
 inline void async_connect(basic_socket<Protocol, SocketService>& s,
- Iterator begin, ComposedConnectHandler handler)
+ Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ComposedConnectHandler.
   BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
       ComposedConnectHandler, handler, Iterator) type_check;
 
- detail::connect_op<Protocol, SocketService, Iterator,
- detail::default_connect_condition, ComposedConnectHandler>(
- s, begin, Iterator(), detail::default_connect_condition(), handler)(
+ detail::make_connect_op(s, begin, Iterator(),
+ detail::default_connect_condition(),
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
         boost::system::error_code(), 1);
 }
 
 template <typename Protocol, typename SocketService,
     typename Iterator, typename ComposedConnectHandler>
 inline void async_connect(basic_socket<Protocol, SocketService>& s,
- Iterator begin, Iterator end, ComposedConnectHandler handler)
+ Iterator begin, Iterator end,
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ComposedConnectHandler.
   BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
       ComposedConnectHandler, handler, Iterator) type_check;
 
- detail::connect_op<Protocol, SocketService, Iterator,
- detail::default_connect_condition, ComposedConnectHandler>(
- s, begin, end, detail::default_connect_condition(), handler)(
+ detail::make_connect_op(s, begin, end,
+ detail::default_connect_condition(),
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
         boost::system::error_code(), 1);
 }
 
@@ -308,34 +355,32 @@
     typename ConnectCondition, typename ComposedConnectHandler>
 inline void async_connect(basic_socket<Protocol, SocketService>& s,
     Iterator begin, ConnectCondition connect_condition,
- ComposedConnectHandler handler)
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ComposedConnectHandler.
   BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
       ComposedConnectHandler, handler, Iterator) type_check;
 
- detail::connect_op<Protocol, SocketService, Iterator,
- ConnectCondition, ComposedConnectHandler>(
- s, begin, Iterator(), connect_condition, handler)(
- boost::system::error_code(), 1);
+ detail::make_connect_op(s, begin, Iterator(), connect_condition,
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
 }
 
 template <typename Protocol, typename SocketService, typename Iterator,
     typename ConnectCondition, typename ComposedConnectHandler>
 void async_connect(basic_socket<Protocol, SocketService>& s,
     Iterator begin, Iterator end, ConnectCondition connect_condition,
- ComposedConnectHandler handler)
+ BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ComposedConnectHandler.
   BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
       ComposedConnectHandler, handler, Iterator) type_check;
 
- detail::connect_op<Protocol, SocketService, Iterator,
- ConnectCondition, ComposedConnectHandler>(
- s, begin, end, connect_condition, handler)(
- boost::system::error_code(), 1);
+ detail::make_connect_op(s, begin, end, connect_condition,
+ BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))(
+ boost::system::error_code(), 1);
 }
 
 } // namespace asio

Modified: trunk/boost/asio/impl/io_service.hpp
==============================================================================
--- trunk/boost/asio/impl/io_service.hpp (original)
+++ trunk/boost/asio/impl/io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -70,23 +70,24 @@
 namespace asio {
 
 template <typename CompletionHandler>
-inline void io_service::dispatch(CompletionHandler handler)
+inline void io_service::dispatch(
+ BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a CompletionHandler.
   BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
 
- impl_.dispatch(handler);
+ impl_.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
 }
 
 template <typename CompletionHandler>
-inline void io_service::post(CompletionHandler handler)
+inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a CompletionHandler.
   BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
 
- impl_.post(handler);
+ impl_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
 }
 
 template <typename Handler>

Modified: trunk/boost/asio/impl/read.hpp
==============================================================================
--- trunk/boost/asio/impl/read.hpp (original)
+++ trunk/boost/asio/impl/read.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -157,6 +157,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_op(const read_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_op(read_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -166,7 +186,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- stream_.async_read_some(buffers_, *this);
+ stream_.async_read_some(buffers_,
+ BOOST_ASIO_MOVE_CAST(read_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -197,8 +218,7 @@
   public:
     read_op(AsyncReadStream& stream,
         const boost::asio::mutable_buffers_1& buffers,
- CompletionCondition completion_condition,
- ReadHandler& handler)
+ CompletionCondition completion_condition, ReadHandler& handler)
       : detail::base_from_completion_cond<
           CompletionCondition>(completion_condition),
         stream_(stream),
@@ -208,6 +228,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_op(const read_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_op(read_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -218,8 +258,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_read_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_read_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(read_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -262,6 +303,17 @@
   template <typename Function, typename AsyncReadStream,
       typename MutableBufferSequence, typename CompletionCondition,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_op<AsyncReadStream, MutableBufferSequence,
         CompletionCondition, ReadHandler>* this_handler)
@@ -269,36 +321,47 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename MutableBufferSequence,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_op<AsyncReadStream, MutableBufferSequence,
+ CompletionCondition, ReadHandler>
+ make_read_op(AsyncReadStream& s, const MutableBufferSequence& buffers,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition,
+ ReadHandler>(s, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_op<AsyncReadStream, MutableBufferSequence,
- CompletionCondition, ReadHandler>(
- s, buffers, completion_condition, handler)(
+ detail::make_read_op(
+ s, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename ReadHandler>
 inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_op<AsyncReadStream, MutableBufferSequence,
- detail::transfer_all_t, ReadHandler>(
- s, buffers, transfer_all(), handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_op(
+ s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
@@ -323,6 +386,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_streambuf_op(const read_streambuf_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_streambuf_op(read_streambuf_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -334,7 +417,8 @@
         bytes_available = read_size_helper(streambuf_, max_size);
         for (;;)
         {
- stream_.async_read_some(streambuf_.prepare(bytes_available), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_available),
+ BOOST_ASIO_MOVE_CAST(read_streambuf_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           streambuf_.commit(bytes_transferred);
@@ -377,6 +461,16 @@
 
   template <typename Function, typename AsyncReadStream,
       typename Allocator, typename CompletionCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename Allocator, typename CompletionCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_streambuf_op<AsyncReadStream, Allocator,
         CompletionCondition, ReadHandler>* this_handler)
@@ -384,36 +478,48 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_streambuf_op<AsyncReadStream, Allocator,
+ CompletionCondition, ReadHandler>
+ make_read_streambuf_op(
+ AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition,
+ ReadHandler>(s, b, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_streambuf_op<AsyncReadStream,
- Allocator, CompletionCondition, ReadHandler>(
- s, b, completion_condition, handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_streambuf_op(
+ s, b, completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 inline void async_read(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b, ReadHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_streambuf_op<AsyncReadStream,
- Allocator, detail::transfer_all_t, ReadHandler>(
- s, b, transfer_all(), handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_streambuf_op(
+ s, b, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: trunk/boost/asio/impl/read_at.hpp
==============================================================================
--- trunk/boost/asio/impl/read_at.hpp (original)
+++ trunk/boost/asio/impl/read_at.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -170,6 +170,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_op(const read_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_at_op(read_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -179,8 +201,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- device_.async_read_some_at(
- offset_ + total_transferred_, buffers_, *this);
+ device_.async_read_some_at(offset_ + total_transferred_,
+ buffers_, BOOST_ASIO_MOVE_CAST(read_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -223,6 +245,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_op(const read_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_at_op(read_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -234,7 +278,8 @@
         for (;;)
         {
           device_.async_read_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(read_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -280,6 +325,17 @@
   template <typename Function, typename AsyncRandomAccessReadDevice,
       typename MutableBufferSequence, typename CompletionCondition,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessReadDevice,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence,
         CompletionCondition, ReadHandler>* this_handler)
@@ -287,21 +343,36 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessReadDevice,
+ typename MutableBufferSequence, typename CompletionCondition,
+ typename ReadHandler>
+ inline read_at_op<AsyncRandomAccessReadDevice,
+ MutableBufferSequence, CompletionCondition, ReadHandler>
+ make_read_at_op(AsyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_at_op<AsyncRandomAccessReadDevice,
+ MutableBufferSequence, CompletionCondition, ReadHandler>(
+ d, offset, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_at_op<AsyncRandomAccessReadDevice,
- MutableBufferSequence, CompletionCondition, ReadHandler>(
- d, offset, buffers, completion_condition, handler)(
+ detail::make_read_at_op(
+ d, offset, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -309,15 +380,15 @@
     typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_at_op<AsyncRandomAccessReadDevice,
- MutableBufferSequence, detail::transfer_all_t, ReadHandler>(
- d, offset, buffers, transfer_all(), handler)(
+ detail::make_read_at_op(
+ d, offset, buffers, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -344,6 +415,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_at_streambuf_op(const read_at_streambuf_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_at_streambuf_op(read_at_streambuf_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ streambuf_(other.streambuf_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -356,7 +449,8 @@
         for (;;)
         {
           device_.async_read_some_at(offset_ + total_transferred_,
- streambuf_.prepare(bytes_available), *this);
+ streambuf_.prepare(bytes_available),
+ BOOST_ASIO_MOVE_CAST(read_at_streambuf_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           streambuf_.commit(bytes_transferred);
@@ -400,6 +494,16 @@
 
   template <typename Function, typename AsyncRandomAccessReadDevice,
       typename Allocator, typename CompletionCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
+ CompletionCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessReadDevice,
+ typename Allocator, typename CompletionCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator,
         CompletionCondition, ReadHandler>* this_handler)
@@ -407,21 +511,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessReadDevice, typename Allocator,
+ typename CompletionCondition, typename ReadHandler>
+ inline read_at_streambuf_op<AsyncRandomAccessReadDevice,
+ Allocator, CompletionCondition, ReadHandler>
+ make_read_at_streambuf_op(AsyncRandomAccessReadDevice& d,
+ boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
+ CompletionCondition completion_condition, ReadHandler handler)
+ {
+ return read_at_streambuf_op<AsyncRandomAccessReadDevice,
+ Allocator, CompletionCondition, ReadHandler>(
+ d, offset, b, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessReadDevice, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_at_streambuf_op<AsyncRandomAccessReadDevice,
- Allocator, CompletionCondition, ReadHandler>(
- d, offset, b, completion_condition, handler)(
+ detail::make_read_at_streambuf_op(
+ d, offset, b, completion_condition,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -429,15 +547,15 @@
     typename ReadHandler>
 inline void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_at_streambuf_op<AsyncRandomAccessReadDevice,
- Allocator, detail::transfer_all_t, ReadHandler>(
- d, offset, b, transfer_all(), handler)(
+ detail::make_read_at_streambuf_op(
+ d, offset, b, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 

Modified: trunk/boost/asio/impl/read_until.hpp
==============================================================================
--- trunk/boost/asio/impl/read_until.hpp (original)
+++ trunk/boost/asio/impl/read_until.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -336,6 +336,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_delim_op(const read_until_delim_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_delim_op(read_until_delim_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -386,7 +406,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_delim_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -433,6 +454,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_delim_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_delim_op<AsyncReadStream,
         Allocator, ReadHandler>* this_handler)
@@ -440,20 +471,30 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>
+ make_read_until_delim_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ char delim, ReadHandler handler)
+ {
+ return read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>(
+ s, b, delim, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
- boost::asio::basic_streambuf<Allocator>& b, char delim, ReadHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b, char delim,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_until_delim_op<
- AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_until_delim_op(
+ s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -473,6 +514,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_delim_string_op(const read_until_delim_string_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(other.delim_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_delim_string_op(read_until_delim_string_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -534,7 +595,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_delim_string_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -581,6 +643,16 @@
 
   template <typename Function, typename AsyncReadStream,
       typename Allocator, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_delim_string_op<AsyncReadStream,
+ Allocator, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream,
+ typename Allocator, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_delim_string_op<AsyncReadStream,
         Allocator, ReadHandler>* this_handler)
@@ -588,21 +660,30 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+ inline read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>
+ make_read_until_delim_string_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ const std::string& delim, ReadHandler handler)
+ {
+ return read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>(
+ s, b, delim, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_until_delim_string_op<
- AsyncReadStream, Allocator, ReadHandler>(
- s, b, delim, handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_until_delim_string_op(
+ s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -623,6 +704,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_expr_op(const read_until_expr_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ expr_(other.expr_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_expr_op(read_until_expr_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ expr_(other.expr_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -687,7 +788,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_expr_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -736,6 +838,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename RegEx, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_expr_op<AsyncReadStream,
+ Allocator, RegEx, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename RegEx, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_expr_op<AsyncReadStream,
         Allocator, RegEx, ReadHandler>* this_handler)
@@ -743,21 +855,31 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename RegEx, typename ReadHandler>
+ inline read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>
+ make_read_until_expr_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ const boost::regex& expr, ReadHandler handler)
+ {
+ return read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>(
+ s, b, expr, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_until_expr_op<AsyncReadStream,
- Allocator, boost::regex, ReadHandler>(
- s, b, expr, handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_until_expr_op(
+ s, b, expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 namespace detail
@@ -778,6 +900,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ read_until_match_op(const read_until_match_op& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ match_condition_(other.match_condition_),
+ search_position_(other.search_position_),
+ handler_(other.handler_)
+ {
+ }
+
+ read_until_match_op(read_until_match_op&& other)
+ : stream_(other.stream_),
+ streambuf_(other.streambuf_),
+ match_condition_(other.match_condition_),
+ search_position_(other.search_position_),
+ handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -838,7 +980,8 @@
             break;
 
           // Start a new asynchronous read operation to obtain more data.
- stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this);
+ stream_.async_read_some(streambuf_.prepare(bytes_to_read),
+ BOOST_ASIO_MOVE_CAST(read_until_match_op)(*this));
           return; default:
           streambuf_.commit(bytes_transferred);
           if (ec || bytes_transferred == 0)
@@ -887,6 +1030,16 @@
 
   template <typename Function, typename AsyncReadStream, typename Allocator,
       typename MatchCondition, typename ReadHandler>
+ inline void asio_handler_invoke(Function& function,
+ read_until_match_op<AsyncReadStream,
+ Allocator, MatchCondition, ReadHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncReadStream, typename Allocator,
+ typename MatchCondition, typename ReadHandler>
   inline void asio_handler_invoke(const Function& function,
       read_until_match_op<AsyncReadStream,
         Allocator, MatchCondition, ReadHandler>* this_handler)
@@ -894,23 +1047,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncReadStream, typename Allocator,
+ typename MatchCondition, typename ReadHandler>
+ inline read_until_match_op<AsyncReadStream, Allocator,
+ MatchCondition, ReadHandler>
+ make_read_until_match_op(AsyncReadStream& s,
+ boost::asio::basic_streambuf<Allocator>& b,
+ MatchCondition match_condition, ReadHandler handler)
+ {
+ return read_until_match_op<AsyncReadStream,
+ Allocator, MatchCondition, ReadHandler>(
+ s, b, match_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncReadStream, typename Allocator,
     typename MatchCondition, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- MatchCondition match_condition, ReadHandler handler,
+ MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
     typename boost::enable_if<is_match_condition<MatchCondition> >::type*)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a ReadHandler.
   BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
- detail::read_until_match_op<
- AsyncReadStream, Allocator, MatchCondition, ReadHandler>(
- s, b, match_condition, handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_read_until_match_op(
+ s, b, match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 } // namespace asio

Modified: trunk/boost/asio/impl/write.hpp
==============================================================================
--- trunk/boost/asio/impl/write.hpp (original)
+++ trunk/boost/asio/impl/write.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -143,6 +143,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -152,7 +172,8 @@
         buffers_.prepare(this->check_for_completion(ec, total_transferred_));
         for (;;)
         {
- stream_.async_write_some(buffers_, *this);
+ stream_.async_write_some(buffers_,
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -194,6 +215,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -204,8 +245,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_write_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_write_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -245,6 +287,26 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_op(const write_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_op(write_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ stream_(other.stream_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -255,8 +317,9 @@
         n = this->check_for_completion(ec, total_transferred_);
         for (;;)
         {
- stream_.async_write_some(boost::asio::buffer(
- buffer_ + total_transferred_, n), *this);
+ stream_.async_write_some(
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -299,6 +362,17 @@
   template <typename Function, typename AsyncWriteStream,
       typename ConstBufferSequence, typename CompletionCondition,
       typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncWriteStream,
+ typename ConstBufferSequence, typename CompletionCondition,
+ typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
       write_op<AsyncWriteStream, ConstBufferSequence,
         CompletionCondition, WriteHandler>* this_handler)
@@ -306,44 +380,54 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncWriteStream, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline write_op<AsyncWriteStream, ConstBufferSequence,
+ CompletionCondition, WriteHandler>
+ make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers,
+ CompletionCondition completion_condition, WriteHandler handler)
+ {
+ return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition,
+ WriteHandler>(s, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncWriteStream, typename ConstBufferSequence,
   typename CompletionCondition, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
- detail::write_op<AsyncWriteStream, ConstBufferSequence,
- CompletionCondition, WriteHandler>(
- s, buffers, completion_condition, handler)(
+ detail::make_write_op(
+ s, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename WriteHandler>
 inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
- detail::write_op<AsyncWriteStream, ConstBufferSequence,
- detail::transfer_all_t, WriteHandler>(
- s, buffers, transfer_all(), handler)(
- boost::system::error_code(), 0, 1);
+ detail::make_write_op(
+ s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
+ boost::system::error_code(), 0, 1);
 }
 
 #if !defined(BOOST_NO_IOSTREAM)
 
 namespace detail
 {
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   class write_streambuf_handler
   {
   public:
@@ -354,6 +438,20 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_streambuf_handler(const write_streambuf_handler& other)
+ : streambuf_(other.streambuf_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_streambuf_handler(write_streambuf_handler&& other)
+ : streambuf_(other.streambuf_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         const std::size_t bytes_transferred)
     {
@@ -366,63 +464,75 @@
     WriteHandler handler_;
   };
 
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void* asio_handler_allocate(std::size_t size,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     return boost_asio_handler_alloc_helpers::allocate(
         size, this_handler->handler_);
   }
 
- template <typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void asio_handler_deallocate(void* pointer, std::size_t size,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_alloc_helpers::deallocate(
         pointer, size, this_handler->handler_);
   }
 
- template <typename Function, typename AsyncWriteStream, typename Allocator,
- typename WriteHandler>
+ template <typename Function, typename Allocator, typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Allocator, typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
- write_streambuf_handler<AsyncWriteStream,
- Allocator, WriteHandler>* this_handler)
+ write_streambuf_handler<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename Allocator, typename WriteHandler>
+ inline write_streambuf_handler<Allocator, WriteHandler>
+ make_write_streambuf_handler(
+ boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ {
+ return write_streambuf_handler<Allocator, WriteHandler>(b, handler);
+ }
 } // namespace detail
 
 template <typename AsyncWriteStream, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
   async_write(s, b.data(), completion_condition,
- detail::write_streambuf_handler<
- AsyncWriteStream, Allocator, WriteHandler>(b, handler));
+ detail::make_write_streambuf_handler(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
 inline void async_write(AsyncWriteStream& s,
- boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ boost::asio::basic_streambuf<Allocator>& b,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
   async_write(s, b.data(), transfer_all(),
- detail::write_streambuf_handler<
- AsyncWriteStream, Allocator, WriteHandler>(b, handler));
+ detail::make_write_streambuf_handler(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: trunk/boost/asio/impl/write_at.hpp
==============================================================================
--- trunk/boost/asio/impl/write_at.hpp (original)
+++ trunk/boost/asio/impl/write_at.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -154,6 +154,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffers_(other.buffers_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -164,7 +186,8 @@
         for (;;)
         {
           device_.async_write_some_at(
- offset_ + total_transferred_, buffers_, *this);
+ offset_ + total_transferred_, buffers_,
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           buffers_.consume(bytes_transferred);
@@ -208,6 +231,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -219,7 +264,8 @@
         for (;;)
         {
           device_.async_write_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -261,6 +307,28 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_op(const write_at_op& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_op(write_at_op&& other)
+ : detail::base_from_completion_cond<CompletionCondition>(other),
+ device_(other.device_),
+ offset_(other.offset_),
+ buffer_(other.buffer_),
+ total_transferred_(other.total_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         std::size_t bytes_transferred, int start = 0)
     {
@@ -272,7 +340,8 @@
         for (;;)
         {
           device_.async_write_some_at(offset_ + total_transferred_,
- boost::asio::buffer(buffer_ + total_transferred_, n), *this);
+ boost::asio::buffer(buffer_ + total_transferred_, n),
+ BOOST_ASIO_MOVE_CAST(write_at_op)(*this));
           return; default:
           total_transferred_ += bytes_transferred;
           if ((!ec && bytes_transferred == 0)
@@ -316,6 +385,17 @@
   template <typename Function, typename AsyncRandomAccessWriteDevice,
       typename ConstBufferSequence, typename CompletionCondition,
       typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
+ CompletionCondition, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename AsyncRandomAccessWriteDevice,
+ typename ConstBufferSequence, typename CompletionCondition,
+ typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
       write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence,
         CompletionCondition, WriteHandler>* this_handler)
@@ -323,21 +403,35 @@
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
+ typename CompletionCondition, typename WriteHandler>
+ inline write_at_op<AsyncRandomAccessWriteDevice,
+ ConstBufferSequence, CompletionCondition, WriteHandler>
+ make_write_at_op(AsyncRandomAccessWriteDevice& d,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ CompletionCondition completion_condition, WriteHandler handler)
+ {
+ return write_at_op<AsyncRandomAccessWriteDevice,
+ ConstBufferSequence, CompletionCondition, WriteHandler>(
+ d, offset, buffers, completion_condition, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
- detail::write_at_op<AsyncRandomAccessWriteDevice,
- ConstBufferSequence, CompletionCondition, WriteHandler>(
- d, offset, buffers, completion_condition, handler)(
+ detail::make_write_at_op(
+ d, offset, buffers, completion_condition,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -345,15 +439,15 @@
     typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
- detail::write_at_op<AsyncRandomAccessWriteDevice,
- ConstBufferSequence, detail::transfer_all_t, WriteHandler>(
- d, offset, buffers, transfer_all(), handler)(
+ detail::make_write_at_op(
+ d, offset, buffers, transfer_all(),
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))(
         boost::system::error_code(), 0, 1);
 }
 
@@ -361,8 +455,7 @@
 
 namespace detail
 {
- template <typename AsyncRandomAccessWriteDevice,
- typename Allocator, typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   class write_at_streambuf_op
   {
   public:
@@ -374,6 +467,20 @@
     {
     }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ write_at_streambuf_op(const write_at_streambuf_op& other)
+ : streambuf_(other.streambuf_),
+ handler_(other.handler_)
+ {
+ }
+
+ write_at_streambuf_op(write_at_streambuf_op&& other)
+ : streambuf_(other.streambuf_),
+ handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
     void operator()(const boost::system::error_code& ec,
         const std::size_t bytes_transferred)
     {
@@ -386,65 +493,76 @@
     WriteHandler handler_;
   };
 
- template <typename AsyncRandomAccessWriteDevice, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void* asio_handler_allocate(std::size_t size,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     return boost_asio_handler_alloc_helpers::allocate(
         size, this_handler->handler_);
   }
 
- template <typename AsyncRandomAccessWriteDevice, typename Allocator,
- typename WriteHandler>
+ template <typename Allocator, typename WriteHandler>
   inline void asio_handler_deallocate(void* pointer, std::size_t size,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_alloc_helpers::deallocate(
         pointer, size, this_handler->handler_);
   }
 
- template <typename Function, typename AsyncRandomAccessWriteDevice,
- typename Allocator, typename WriteHandler>
+ template <typename Function, typename Allocator, typename WriteHandler>
+ inline void asio_handler_invoke(Function& function,
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
+ {
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+ }
+
+ template <typename Function, typename Allocator, typename WriteHandler>
   inline void asio_handler_invoke(const Function& function,
- write_at_streambuf_op<AsyncRandomAccessWriteDevice,
- Allocator, WriteHandler>* this_handler)
+ write_at_streambuf_op<Allocator, WriteHandler>* this_handler)
   {
     boost_asio_handler_invoke_helpers::invoke(
         function, this_handler->handler_);
   }
+
+ template <typename Allocator, typename WriteHandler>
+ inline write_at_streambuf_op<Allocator, WriteHandler>
+ make_write_at_streambuf_op(
+ boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler)
+ {
+ return write_at_streambuf_op<Allocator, WriteHandler>(b, handler);
+ }
 } // namespace detail
 
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler)
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
   async_write_at(d, offset, b.data(), completion_condition,
- detail::write_at_streambuf_op<
- AsyncRandomAccessWriteDevice, Allocator, WriteHandler>(b, handler));
+ detail::make_write_at_streambuf_op(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename WriteHandler>
 inline void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
 {
   // If you get an error on the following line it means that your handler does
   // not meet the documented type requirements for a WriteHandler.
   BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
   async_write_at(d, offset, b.data(), transfer_all(),
- detail::write_at_streambuf_op<
- AsyncRandomAccessWriteDevice, Allocator, WriteHandler>(b, handler));
+ detail::make_write_at_streambuf_op(
+ b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
 }
 
 #endif // !defined(BOOST_NO_IOSTREAM)

Modified: trunk/boost/asio/io_service.hpp
==============================================================================
--- trunk/boost/asio/io_service.hpp (original)
+++ trunk/boost/asio/io_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -441,7 +441,7 @@
    * throws an exception.
    */
   template <typename CompletionHandler>
- void dispatch(CompletionHandler handler);
+ void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler);
 
   /// Request the io_service to invoke the given handler and return immediately.
   /**
@@ -466,7 +466,7 @@
    * throws an exception.
    */
   template <typename CompletionHandler>
- void post(CompletionHandler handler);
+ void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler);
 
   /// Create a new handler that automatically dispatches the wrapped handler
   /// on the io_service.

Modified: trunk/boost/asio/ip/basic_resolver.hpp
==============================================================================
--- trunk/boost/asio/ip/basic_resolver.hpp (original)
+++ trunk/boost/asio/ip/basic_resolver.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -153,7 +153,8 @@
    * the handler.
    */
   template <typename ResolveHandler>
- void async_resolve(const query& q, ResolveHandler handler)
+ void async_resolve(const query& q,
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ResolveHandler.
@@ -243,7 +244,8 @@
    * the handler.
    */
   template <typename ResolveHandler>
- void async_resolve(const endpoint_type& e, ResolveHandler handler)
+ void async_resolve(const endpoint_type& e,
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ResolveHandler.

Modified: trunk/boost/asio/ip/resolver_service.hpp
==============================================================================
--- trunk/boost/asio/ip/resolver_service.hpp (original)
+++ trunk/boost/asio/ip/resolver_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -103,11 +103,12 @@
   }
 
   /// Asynchronously resolve a query to a list of entries.
- template <typename Handler>
+ template <typename ResolveHandler>
   void async_resolve(implementation_type& impl, const query_type& query,
- Handler handler)
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- service_impl_.async_resolve(impl, query, handler);
+ service_impl_.async_resolve(impl, query,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 
   /// Resolve an endpoint to a list of entries.
@@ -120,9 +121,10 @@
   /// Asynchronously resolve an endpoint to a list of entries.
   template <typename ResolveHandler>
   void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
- ResolveHandler handler)
+ BOOST_ASIO_MOVE_ARG(ResolveHandler) handler)
   {
- return service_impl_.async_resolve(impl, endpoint, handler);
+ return service_impl_.async_resolve(impl, endpoint,
+ BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/posix/basic_stream_descriptor.hpp
==============================================================================
--- trunk/boost/asio/posix/basic_stream_descriptor.hpp (original)
+++ trunk/boost/asio/posix/basic_stream_descriptor.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -226,7 +226,7 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -337,7 +337,7 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/posix/stream_descriptor_service.hpp
==============================================================================
--- trunk/boost/asio/posix/stream_descriptor_service.hpp (original)
+++ trunk/boost/asio/posix/stream_descriptor_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -199,9 +199,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, handler);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -215,9 +217,11 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, handler);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/raw_socket_service.hpp
==============================================================================
--- trunk/boost/asio/raw_socket_service.hpp (original)
+++ trunk/boost/asio/raw_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -201,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -289,9 +291,11 @@
   /// Start an asynchronous send.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl, const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Send raw data to the specified endpoint.
@@ -307,9 +311,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send_to(implementation_type& impl,
       const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send_to(impl, buffers, destination, flags, handler);
+ service_impl_.async_send_to(impl, buffers, destination, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -325,9 +331,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
   /// Receive raw data with the endpoint of the sender.
@@ -344,10 +352,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive_from(implementation_type& impl,
       const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags,
- handler);
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/read.hpp
==============================================================================
--- trunk/boost/asio/read.hpp (original)
+++ trunk/boost/asio/read.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -415,7 +415,7 @@
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename ReadHandler>
 void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data from a
 /// stream.
@@ -483,7 +483,8 @@
 template <typename AsyncReadStream, typename MutableBufferSequence,
     typename CompletionCondition, typename ReadHandler>
 void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -535,7 +536,7 @@
  */
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data from a
 /// stream.
@@ -594,7 +595,8 @@
 template <typename AsyncReadStream, typename Allocator,
     typename CompletionCondition, typename ReadHandler>
 void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: trunk/boost/asio/read_at.hpp
==============================================================================
--- trunk/boost/asio/read_at.hpp (original)
+++ trunk/boost/asio/read_at.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -456,7 +456,8 @@
 template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence,
     typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler);
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data at the
 /// specified offset.
@@ -527,7 +528,8 @@
     typename CompletionCondition, typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, const MutableBufferSequence& buffers,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -579,7 +581,7 @@
 template <typename AsyncRandomAccessReadDevice, typename Allocator,
     typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset,
- basic_streambuf<Allocator>& b, ReadHandler handler);
+ basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read a certain amount of data at the
 /// specified offset.
@@ -638,7 +640,8 @@
     typename CompletionCondition, typename ReadHandler>
 void async_read_at(AsyncRandomAccessReadDevice& d,
     boost::uint64_t offset, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, ReadHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: trunk/boost/asio/read_until.hpp
==============================================================================
--- trunk/boost/asio/read_until.hpp (original)
+++ trunk/boost/asio/read_until.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -36,30 +36,16 @@
 
 namespace detail
 {
-#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
+ char (&has_result_type_helper(...))[2];
+
   template <typename T>
- struct has_result_type
- {
- template <typename U> struct inner
- {
- struct big { char a[100]; };
- static big helper(U, ...);
- static char helper(U, typename U::result_type* = 0);
- };
- static const T& ref();
- enum { value = (sizeof((inner<const T&>::helper)((ref)())) == 1) };
- };
-#else // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
+ char has_result_type_helper(T*, typename T::result_type* = 0);
+
   template <typename T>
   struct has_result_type
   {
- struct big { char a[100]; };
- template <typename U> static big helper(U, ...);
- template <typename U> static char helper(U, typename U::result_type* = 0);
- static const T& ref();
- enum { value = (sizeof((helper)((ref)())) == 1) };
+ enum { value = (sizeof((has_result_type_helper)((T*)(0))) == 1) };
   };
-#endif // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610))
 } // namespace detail
 
 /// Type trait used to determine whether a type can be used as a match condition
@@ -604,7 +590,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- char delim, ReadHandler handler);
+ char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until it
 /// contains a specified delimiter.
@@ -687,7 +673,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const std::string& delim,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until some
 /// part of its data matches a regular expression.
@@ -774,7 +760,7 @@
 template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr,
- ReadHandler handler);
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
 
 /// Start an asynchronous operation to read data into a streambuf until a
 /// function object indicates a match.
@@ -903,7 +889,7 @@
     typename MatchCondition, typename ReadHandler>
 void async_read_until(AsyncReadStream& s,
     boost::asio::basic_streambuf<Allocator>& b,
- MatchCondition match_condition, ReadHandler handler,
+ MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
     typename boost::enable_if<is_match_condition<MatchCondition> >::type* = 0);
 
 /*@}*/

Modified: trunk/boost/asio/seq_packet_socket_service.hpp
==============================================================================
--- trunk/boost/asio/seq_packet_socket_service.hpp (original)
+++ trunk/boost/asio/seq_packet_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -203,9 +203,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -292,9 +294,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -311,10 +315,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, ReadHandler handler)
+ socket_base::message_flags& out_flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive_with_flags(impl,
- buffers, in_flags, out_flags, handler);
+ service_impl_.async_receive_with_flags(impl, buffers, in_flags,
+ out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/serial_port_service.hpp
==============================================================================
--- trunk/boost/asio/serial_port_service.hpp (original)
+++ trunk/boost/asio/serial_port_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -193,9 +193,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, handler);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -209,9 +211,11 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, handler);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/signal_set_service.hpp
==============================================================================
--- trunk/boost/asio/signal_set_service.hpp (original)
+++ trunk/boost/asio/signal_set_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -96,9 +96,11 @@
 
   // Start an asynchronous operation to wait for a signal to be delivered.
   template <typename SignalHandler>
- void async_wait(implementation_type& impl, SignalHandler handler)
+ void async_wait(implementation_type& impl,
+ BOOST_ASIO_MOVE_ARG(SignalHandler) handler)
   {
- service_impl_.async_wait(impl, handler);
+ service_impl_.async_wait(impl,
+ BOOST_ASIO_MOVE_CAST(SignalHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/socket_acceptor_service.hpp
==============================================================================
--- trunk/boost/asio/socket_acceptor_service.hpp (original)
+++ trunk/boost/asio/socket_acceptor_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -251,9 +251,11 @@
   template <typename SocketService, typename AcceptHandler>
   void async_accept(implementation_type& impl,
       basic_socket<protocol_type, SocketService>& peer,
- endpoint_type* peer_endpoint, AcceptHandler handler)
+ endpoint_type* peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(AcceptHandler) handler)
   {
- service_impl_.async_accept(impl, peer, peer_endpoint, handler);
+ service_impl_.async_accept(impl, peer, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/ssl/detail/io.hpp
==============================================================================
--- trunk/boost/asio/ssl/detail/io.hpp (original)
+++ trunk/boost/asio/ssl/detail/io.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -101,6 +101,30 @@
   {
   }
 
+#if defined(BOOST_ASIO_HAS_MOVE)
+ io_op(const io_op& other)
+ : next_layer_(other.next_layer_),
+ core_(other.core_),
+ op_(other.op_),
+ want_(other.want_),
+ ec_(other.ec_),
+ bytes_transferred_(other.bytes_transferred_),
+ handler_(other.handler_)
+ {
+ }
+
+ io_op(io_op&& other)
+ : next_layer_(other.next_layer_),
+ core_(other.core_),
+ op_(other.op_),
+ want_(other.want_),
+ ec_(other.ec_),
+ bytes_transferred_(other.bytes_transferred_),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_))
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
   void operator()(boost::system::error_code ec,
       std::size_t bytes_transferred = ~std::size_t(0), int start = 0)
   {
@@ -132,12 +156,13 @@
 
             // Start reading some data from the underlying transport.
             next_layer_.async_read_some(
- boost::asio::buffer(core_.input_buffer_), *this);
+ boost::asio::buffer(core_.input_buffer_),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
           }
           else
           {
             // Wait until the current read operation completes.
- core_.pending_read_.async_wait(*this);
+ core_.pending_read_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
           }
 
           // Yield control until asynchronous operation completes. Control
@@ -158,12 +183,13 @@
 
             // Start writing all the data to the underlying transport.
             boost::asio::async_write(next_layer_,
- core_.engine_.get_output(core_.output_buffer_), *this);
+ core_.engine_.get_output(core_.output_buffer_),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
           }
           else
           {
             // Wait until the current write operation completes.
- core_.pending_write_.async_wait(*this);
+ core_.pending_write_.async_wait(BOOST_ASIO_MOVE_CAST(io_op)(*this));
           }
 
           // Yield control until asynchronous operation completes. Control
@@ -180,7 +206,8 @@
           if (start)
           {
             next_layer_.async_read_some(
- boost::asio::buffer(core_.input_buffer_, 0), *this);
+ boost::asio::buffer(core_.input_buffer_, 0),
+ BOOST_ASIO_MOVE_CAST(io_op)(*this));
 
             // Yield control until asynchronous operation completes. Control
             // resumes at the "default:" label below.
@@ -272,6 +299,15 @@
 
 template <typename Function, typename Stream,
     typename Operation, typename Handler>
+inline void asio_handler_invoke(Function& function,
+ io_op<Stream, Operation, Handler>* this_handler)
+{
+ boost_asio_handler_invoke_helpers::invoke(
+ function, this_handler->handler_);
+}
+
+template <typename Function, typename Stream,
+ typename Operation, typename Handler>
 inline void asio_handler_invoke(const Function& function,
     io_op<Stream, Operation, Handler>* this_handler)
 {
@@ -281,7 +317,7 @@
 
 template <typename Stream, typename Operation, typename Handler>
 inline void async_io(Stream& next_layer, stream_core& core,
- const Operation& op, Handler& handler)
+ const Operation& op, Handler handler)
 {
   io_op<Stream, Operation, Handler>(
     next_layer, core, op, handler)(

Modified: trunk/boost/asio/ssl/stream.hpp
==============================================================================
--- trunk/boost/asio/ssl/stream.hpp (original)
+++ trunk/boost/asio/ssl/stream.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -360,13 +360,14 @@
    */
   template <typename HandshakeHandler>
   void async_handshake(handshake_type type,
- HandshakeHandler handler)
+ BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a HandshakeHandler.
     BOOST_ASIO_HANDSHAKE_HANDLER_CHECK(HandshakeHandler, handler) type_check;
 
- detail::async_io(next_layer_, core_, detail::handshake_op(type), handler);
+ detail::async_io(next_layer_, core_, detail::handshake_op(type),
+ BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
   }
 
   /// Shut down SSL on the stream.
@@ -409,13 +410,14 @@
    * ); @endcode
    */
   template <typename ShutdownHandler>
- void async_shutdown(ShutdownHandler handler)
+ void async_shutdown(BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ShutdownHandler.
     BOOST_ASIO_SHUTDOWN_HANDLER_CHECK(ShutdownHandler, handler) type_check;
 
- detail::async_io(next_layer_, core_, detail::shutdown_op(), handler);
+ detail::async_io(next_layer_, core_, detail::shutdown_op(),
+ BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler));
   }
 
   /// Write some data to the stream.
@@ -491,14 +493,15 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
     BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
 
     detail::async_io(next_layer_, core_,
- detail::write_op<ConstBufferSequence>(buffers), handler);
+ detail::write_op<ConstBufferSequence>(buffers),
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -575,14 +578,15 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.
     BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
 
     detail::async_io(next_layer_, core_,
- detail::read_op<MutableBufferSequence>(buffers), handler);
+ detail::read_op<MutableBufferSequence>(buffers),
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/strand.hpp
==============================================================================
--- trunk/boost/asio/strand.hpp (original)
+++ trunk/boost/asio/strand.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -141,13 +141,13 @@
    * @code void handler(); @endcode
    */
   template <typename CompletionHandler>
- void dispatch(CompletionHandler handler)
+ void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a CompletionHandler.
     BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
 
- service_.dispatch(impl_, handler);
+ service_.dispatch(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
   }
 
   /// Request the strand to invoke the given handler and return
@@ -167,13 +167,13 @@
    * @code void handler(); @endcode
    */
   template <typename CompletionHandler>
- void post(CompletionHandler handler)
+ void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a CompletionHandler.
     BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
 
- service_.post(impl_, handler);
+ service_.post(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
   }
 
   /// Create a new handler that automatically dispatches the wrapped handler

Modified: trunk/boost/asio/stream_socket_service.hpp
==============================================================================
--- trunk/boost/asio/stream_socket_service.hpp (original)
+++ trunk/boost/asio/stream_socket_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -201,9 +201,11 @@
   /// Start an asynchronous connect.
   template <typename ConnectHandler>
   void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, ConnectHandler handler)
+ const endpoint_type& peer_endpoint,
+ BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
   {
- service_impl_.async_connect(impl, peer_endpoint, handler);
+ service_impl_.async_connect(impl, peer_endpoint,
+ BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
   }
 
   /// Set a socket option.
@@ -290,9 +292,11 @@
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_send(implementation_type& impl,
       const ConstBufferSequence& buffers,
- socket_base::message_flags flags, WriteHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_send(impl, buffers, flags, handler);
+ service_impl_.async_send(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Receive some data from the peer.
@@ -308,9 +312,11 @@
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_receive(implementation_type& impl,
       const MutableBufferSequence& buffers,
- socket_base::message_flags flags, ReadHandler handler)
+ socket_base::message_flags flags,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_receive(impl, buffers, flags, handler);
+ service_impl_.async_receive(impl, buffers, flags,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/windows/basic_random_access_handle.hpp
==============================================================================
--- trunk/boost/asio/windows/basic_random_access_handle.hpp (original)
+++ trunk/boost/asio/windows/basic_random_access_handle.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -231,7 +231,8 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some_at(boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -349,7 +350,8 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some_at(boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/windows/basic_stream_handle.hpp
==============================================================================
--- trunk/boost/asio/windows/basic_stream_handle.hpp (original)
+++ trunk/boost/asio/windows/basic_stream_handle.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -223,7 +223,7 @@
    */
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(const ConstBufferSequence& buffers,
- WriteHandler handler)
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a WriteHandler.
@@ -334,7 +334,7 @@
    */
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(const MutableBufferSequence& buffers,
- ReadHandler handler)
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
     // If you get an error on the following line it means that your handler does
     // not meet the documented type requirements for a ReadHandler.

Modified: trunk/boost/asio/windows/overlapped_ptr.hpp
==============================================================================
--- trunk/boost/asio/windows/overlapped_ptr.hpp (original)
+++ trunk/boost/asio/windows/overlapped_ptr.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -51,8 +51,9 @@
 
   /// Construct an overlapped_ptr to contain the specified handler.
   template <typename Handler>
- explicit overlapped_ptr(boost::asio::io_service& io_service, Handler handler)
- : impl_(io_service, handler)
+ explicit overlapped_ptr(boost::asio::io_service& io_service,
+ BOOST_ASIO_MOVE_ARG(Handler) handler)
+ : impl_(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler))
   {
   }
 
@@ -70,9 +71,10 @@
   /// Reset to contain the specified handler, freeing any current OVERLAPPED
   /// object.
   template <typename Handler>
- void reset(boost::asio::io_service& io_service, Handler handler)
+ void reset(boost::asio::io_service& io_service,
+ BOOST_ASIO_MOVE_ARG(Handler) handler)
   {
- impl_.reset(io_service, handler);
+ impl_.reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler));
   }
 
   /// Get the contained OVERLAPPED object.

Modified: trunk/boost/asio/windows/random_access_handle_service.hpp
==============================================================================
--- trunk/boost/asio/windows/random_access_handle_service.hpp (original)
+++ trunk/boost/asio/windows/random_access_handle_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -159,10 +159,12 @@
 
   /// Start an asynchronous write at the specified offset.
   template <typename ConstBufferSequence, typename WriteHandler>
- void async_write_some_at(implementation_type& impl, boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ void async_write_some_at(implementation_type& impl,
+ boost::uint64_t offset, const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some_at(impl, offset, buffers, handler);
+ service_impl_.async_write_some_at(impl, offset, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the specified offset.
@@ -175,10 +177,12 @@
 
   /// Start an asynchronous read at the specified offset.
   template <typename MutableBufferSequence, typename ReadHandler>
- void async_read_some_at(implementation_type& impl, boost::uint64_t offset,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ void async_read_some_at(implementation_type& impl,
+ boost::uint64_t offset, const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some_at(impl, offset, buffers, handler);
+ service_impl_.async_read_some_at(impl, offset, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/windows/stream_handle_service.hpp
==============================================================================
--- trunk/boost/asio/windows/stream_handle_service.hpp (original)
+++ trunk/boost/asio/windows/stream_handle_service.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -157,9 +157,11 @@
   /// Start an asynchronous write.
   template <typename ConstBufferSequence, typename WriteHandler>
   void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, WriteHandler handler)
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
   {
- service_impl_.async_write_some(impl, buffers, handler);
+ service_impl_.async_write_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
   }
 
   /// Read some data from the stream.
@@ -173,9 +175,11 @@
   /// Start an asynchronous read.
   template <typename MutableBufferSequence, typename ReadHandler>
   void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, ReadHandler handler)
+ const MutableBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
   {
- service_impl_.async_read_some(impl, buffers, handler);
+ service_impl_.async_read_some(impl, buffers,
+ BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
   }
 
 private:

Modified: trunk/boost/asio/write.hpp
==============================================================================
--- trunk/boost/asio/write.hpp (original)
+++ trunk/boost/asio/write.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -414,7 +414,7 @@
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename WriteHandler>
 void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data to a
 /// stream.
@@ -486,7 +486,8 @@
 template <typename AsyncWriteStream, typename ConstBufferSequence,
     typename CompletionCondition, typename WriteHandler>
 void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -533,7 +534,7 @@
  */
 template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
 void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data to a
 /// stream.
@@ -593,7 +594,8 @@
 template <typename AsyncWriteStream, typename Allocator,
     typename CompletionCondition, typename WriteHandler>
 void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: trunk/boost/asio/write_at.hpp
==============================================================================
--- trunk/boost/asio/write_at.hpp (original)
+++ trunk/boost/asio/write_at.hpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -446,7 +446,8 @@
 template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence,
     typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
- const ConstBufferSequence& buffers, WriteHandler handler);
+ const ConstBufferSequence& buffers,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data at the
 /// specified offset.
@@ -518,7 +519,8 @@
     typename CompletionCondition, typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d,
     boost::uint64_t offset, const ConstBufferSequence& buffers,
- CompletionCondition completion_condition, WriteHandler handler);
+ CompletionCondition completion_condition,
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #if !defined(BOOST_NO_IOSTREAM)
 
@@ -565,7 +567,7 @@
 template <typename AsyncRandomAccessWriteDevice, typename Allocator,
     typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
- basic_streambuf<Allocator>& b, WriteHandler handler);
+ basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 /// Start an asynchronous operation to write a certain amount of data at the
 /// specified offset.
@@ -625,7 +627,7 @@
     typename CompletionCondition, typename WriteHandler>
 void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset,
     basic_streambuf<Allocator>& b, CompletionCondition completion_condition,
- WriteHandler handler);
+ BOOST_ASIO_MOVE_ARG(WriteHandler) handler);
 
 #endif // !defined(BOOST_NO_IOSTREAM)
 

Modified: trunk/libs/asio/example/timers/tick_count_timer.cpp
==============================================================================
--- trunk/libs/asio/example/timers/tick_count_timer.cpp (original)
+++ trunk/libs/asio/example/timers/tick_count_timer.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -103,7 +103,7 @@
 
     timer.expires_from_now(5000);
     std::cout << "Starting asynchronous wait\n";
- timer.async_wait(handle_timeout);
+ timer.async_wait(&handle_timeout);
     io_service.run();
     std::cout << "Finished asynchronous wait\n";
   }

Modified: trunk/libs/asio/example/timers/time_t_timer.cpp
==============================================================================
--- trunk/libs/asio/example/timers/time_t_timer.cpp (original)
+++ trunk/libs/asio/example/timers/time_t_timer.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -80,7 +80,7 @@
 
     timer.expires_from_now(5);
     std::cout << "Starting asynchronous wait\n";
- timer.async_wait(handle_timeout);
+ timer.async_wait(&handle_timeout);
     io_service.run();
     std::cout << "Finished asynchronous wait\n";
   }

Modified: trunk/libs/asio/example/tutorial/timer2/timer.cpp
==============================================================================
--- trunk/libs/asio/example/tutorial/timer2/timer.cpp (original)
+++ trunk/libs/asio/example/tutorial/timer2/timer.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -22,7 +22,7 @@
   boost::asio::io_service io;
 
   boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
- t.async_wait(print);
+ t.async_wait(&print);
 
   io.run();
 

Modified: trunk/libs/asio/test/buffered_read_stream.cpp
==============================================================================
--- trunk/libs/asio/test/buffered_read_stream.cpp (original)
+++ trunk/libs/asio/test/buffered_read_stream.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -146,7 +146,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Modified: trunk/libs/asio/test/buffered_stream.cpp
==============================================================================
--- trunk/libs/asio/test/buffered_stream.cpp (original)
+++ trunk/libs/asio/test/buffered_stream.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -153,7 +153,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Modified: trunk/libs/asio/test/buffered_write_stream.cpp
==============================================================================
--- trunk/libs/asio/test/buffered_write_stream.cpp (original)
+++ trunk/libs/asio/test/buffered_write_stream.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -153,7 +153,7 @@
   client_socket.lowest_layer().connect(server_endpoint);
 
   stream_type server_socket(io_service);
- acceptor.async_accept(server_socket.lowest_layer(), handle_accept);
+ acceptor.async_accept(server_socket.lowest_layer(), &handle_accept);
   io_service.run();
   io_service.reset();
 

Modified: trunk/libs/asio/test/deadline_timer.cpp
==============================================================================
--- trunk/libs/asio/test/deadline_timer.cpp (original)
+++ trunk/libs/asio/test/deadline_timer.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -229,10 +229,10 @@
     timer() : t(io_service) { t.expires_at(boost::posix_time::pos_infin); }
   } timers[50];
 
- timers[2].t.async_wait(timer_handler);
- timers[41].t.async_wait(timer_handler);
+ timers[2].t.async_wait(&timer_handler);
+ timers[41].t.async_wait(&timer_handler);
   for (int i = 10; i < 20; ++i)
- timers[i].t.async_wait(timer_handler);
+ timers[i].t.async_wait(&timer_handler);
 
   BOOST_CHECK(timers[2].t.cancel() == 1);
   BOOST_CHECK(timers[41].t.cancel() == 1);

Modified: trunk/libs/asio/test/io_service.cpp
==============================================================================
--- trunk/libs/asio/test/io_service.cpp (original)
+++ trunk/libs/asio/test/io_service.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -224,10 +224,10 @@
   count = 0;
   int exception_count = 0;
   ios.reset();
- ios.post(throw_exception);
+ ios.post(&throw_exception);
   ios.post(boost::bind(increment, &count));
   ios.post(boost::bind(increment, &count));
- ios.post(throw_exception);
+ ios.post(&throw_exception);
   ios.post(boost::bind(increment, &count));
 
   // No handlers can be called until run() is called.

Modified: trunk/libs/asio/test/ip/tcp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/tcp.cpp (original)
+++ trunk/libs/asio/test/ip/tcp.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -248,8 +248,10 @@
     socket1.connect(ip::tcp::endpoint(ip::tcp::v4(), 0), ec);
     socket1.connect(ip::tcp::endpoint(ip::tcp::v6(), 0), ec);
 
- socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0), connect_handler);
- socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), connect_handler);
+ socket1.async_connect(ip::tcp::endpoint(ip::tcp::v4(), 0),
+ &connect_handler);
+ socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0),
+ &connect_handler);
 
     socket1.set_option(settable_socket_option1);
     socket1.set_option(settable_socket_option1, ec);
@@ -299,12 +301,12 @@
     socket1.send(buffer(const_char_buffer), in_flags, ec);
     socket1.send(null_buffers(), in_flags, ec);
 
- socket1.async_send(buffer(mutable_char_buffer), send_handler);
- socket1.async_send(buffer(const_char_buffer), send_handler);
- socket1.async_send(null_buffers(), send_handler);
- socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
- socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
- socket1.async_send(null_buffers(), in_flags, send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), &send_handler);
+ socket1.async_send(buffer(const_char_buffer), &send_handler);
+ socket1.async_send(null_buffers(), &send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), in_flags, &send_handler);
+ socket1.async_send(buffer(const_char_buffer), in_flags, &send_handler);
+ socket1.async_send(null_buffers(), in_flags, &send_handler);
 
     socket1.receive(buffer(mutable_char_buffer));
     socket1.receive(null_buffers());
@@ -313,11 +315,11 @@
     socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
     socket1.receive(null_buffers(), in_flags, ec);
 
- socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
- socket1.async_receive(null_buffers(), receive_handler);
+ socket1.async_receive(buffer(mutable_char_buffer), &receive_handler);
+ socket1.async_receive(null_buffers(), &receive_handler);
     socket1.async_receive(buffer(mutable_char_buffer), in_flags,
- receive_handler);
- socket1.async_receive(null_buffers(), in_flags, receive_handler);
+ &receive_handler);
+ socket1.async_receive(null_buffers(), in_flags, &receive_handler);
 
     socket1.write_some(buffer(mutable_char_buffer));
     socket1.write_some(buffer(const_char_buffer));
@@ -326,16 +328,16 @@
     socket1.write_some(buffer(const_char_buffer), ec);
     socket1.write_some(null_buffers(), ec);
 
- socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- socket1.async_write_some(buffer(const_char_buffer), write_some_handler);
- socket1.async_write_some(null_buffers(), write_some_handler);
+ socket1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ socket1.async_write_some(buffer(const_char_buffer), &write_some_handler);
+ socket1.async_write_some(null_buffers(), &write_some_handler);
 
     socket1.read_some(buffer(mutable_char_buffer));
     socket1.read_some(buffer(mutable_char_buffer), ec);
     socket1.read_some(null_buffers(), ec);
 
- socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
- socket1.async_read_some(null_buffers(), read_some_handler);
+ socket1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
+ socket1.async_read_some(null_buffers(), &read_some_handler);
   }
   catch (std::exception&)
   {
@@ -638,8 +640,8 @@
     acceptor1.accept(peer_socket, peer_endpoint);
     acceptor1.accept(peer_socket, peer_endpoint, ec);
 
- acceptor1.async_accept(peer_socket, accept_handler);
- acceptor1.async_accept(peer_socket, peer_endpoint, accept_handler);
+ acceptor1.async_accept(peer_socket, &accept_handler);
+ acceptor1.async_accept(peer_socket, peer_endpoint, &accept_handler);
   }
   catch (std::exception&)
   {
@@ -705,16 +707,16 @@
   client_side_socket.close();
   server_side_socket.close();
 
- acceptor.async_accept(server_side_socket, handle_accept);
- client_side_socket.async_connect(server_endpoint, handle_connect);
+ acceptor.async_accept(server_side_socket, &handle_accept);
+ client_side_socket.async_connect(server_endpoint, &handle_connect);
 
   ios.run();
 
   client_side_socket.close();
   server_side_socket.close();
 
- acceptor.async_accept(server_side_socket, client_endpoint, handle_accept);
- client_side_socket.async_connect(server_endpoint, handle_connect);
+ acceptor.async_accept(server_side_socket, client_endpoint, &handle_accept);
+ client_side_socket.async_connect(server_endpoint, &handle_connect);
 
   ios.reset();
   ios.run();
@@ -779,9 +781,9 @@
     ip::tcp::resolver::iterator iter4 = resolver.resolve(e, ec);
     (void)iter4;
 
- resolver.async_resolve(q, resolve_handler);
+ resolver.async_resolve(q, &resolve_handler);
 
- resolver.async_resolve(e, resolve_handler);
+ resolver.async_resolve(e, &resolve_handler);
   }
   catch (std::exception&)
   {

Modified: trunk/libs/asio/test/ip/udp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/udp.cpp (original)
+++ trunk/libs/asio/test/ip/udp.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -148,8 +148,10 @@
     socket1.connect(ip::udp::endpoint(ip::udp::v4(), 0), ec);
     socket1.connect(ip::udp::endpoint(ip::udp::v6(), 0), ec);
 
- socket1.async_connect(ip::udp::endpoint(ip::udp::v4(), 0), connect_handler);
- socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0), connect_handler);
+ socket1.async_connect(ip::udp::endpoint(ip::udp::v4(), 0),
+ &connect_handler);
+ socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0),
+ &connect_handler);
 
     socket1.set_option(settable_socket_option1);
     socket1.set_option(settable_socket_option1, ec);
@@ -199,12 +201,12 @@
     socket1.send(buffer(const_char_buffer), in_flags, ec);
     socket1.send(null_buffers(), in_flags, ec);
 
- socket1.async_send(buffer(mutable_char_buffer), send_handler);
- socket1.async_send(buffer(const_char_buffer), send_handler);
- socket1.async_send(null_buffers(), send_handler);
- socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler);
- socket1.async_send(buffer(const_char_buffer), in_flags, send_handler);
- socket1.async_send(null_buffers(), in_flags, send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), &send_handler);
+ socket1.async_send(buffer(const_char_buffer), &send_handler);
+ socket1.async_send(null_buffers(), &send_handler);
+ socket1.async_send(buffer(mutable_char_buffer), in_flags, &send_handler);
+ socket1.async_send(buffer(const_char_buffer), in_flags, &send_handler);
+ socket1.async_send(null_buffers(), in_flags, &send_handler);
 
     socket1.send_to(buffer(mutable_char_buffer),
         ip::udp::endpoint(ip::udp::v4(), 0));
@@ -244,29 +246,29 @@
         ip::udp::endpoint(ip::udp::v6(), 0), in_flags, ec);
 
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v4(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v6(), 0), send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(mutable_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(buffer(const_char_buffer),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v4(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v4(), 0), in_flags, &send_handler);
     socket1.async_send_to(null_buffers(),
- ip::udp::endpoint(ip::udp::v6(), 0), in_flags, send_handler);
+ ip::udp::endpoint(ip::udp::v6(), 0), in_flags, &send_handler);
 
     socket1.receive(buffer(mutable_char_buffer));
     socket1.receive(null_buffers());
@@ -275,11 +277,11 @@
     socket1.receive(buffer(mutable_char_buffer), in_flags, ec);
     socket1.receive(null_buffers(), in_flags, ec);
 
- socket1.async_receive(buffer(mutable_char_buffer), receive_handler);
- socket1.async_receive(null_buffers(), receive_handler);
+ socket1.async_receive(buffer(mutable_char_buffer), &receive_handler);
+ socket1.async_receive(null_buffers(), &receive_handler);
     socket1.async_receive(buffer(mutable_char_buffer), in_flags,
- receive_handler);
- socket1.async_receive(null_buffers(), in_flags, receive_handler);
+ &receive_handler);
+ socket1.async_receive(null_buffers(), in_flags, &receive_handler);
 
     ip::udp::endpoint endpoint;
     socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@@ -290,13 +292,13 @@
     socket1.receive_from(null_buffers(), endpoint, in_flags, ec);
 
     socket1.async_receive_from(buffer(mutable_char_buffer),
- endpoint, receive_handler);
+ endpoint, &receive_handler);
     socket1.async_receive_from(null_buffers(),
- endpoint, receive_handler);
+ endpoint, &receive_handler);
     socket1.async_receive_from(buffer(mutable_char_buffer),
- endpoint, in_flags, receive_handler);
+ endpoint, in_flags, &receive_handler);
     socket1.async_receive_from(null_buffers(),
- endpoint, in_flags, receive_handler);
+ endpoint, in_flags, &receive_handler);
   }
   catch (std::exception&)
   {
@@ -423,9 +425,9 @@
     ip::udp::resolver::iterator iter4 = resolver.resolve(e, ec);
     (void)iter4;
 
- resolver.async_resolve(q, resolve_handler);
+ resolver.async_resolve(q, &resolve_handler);
 
- resolver.async_resolve(e, resolve_handler);
+ resolver.async_resolve(e, &resolve_handler);
   }
   catch (std::exception&)
   {

Modified: trunk/libs/asio/test/serial_port.cpp
==============================================================================
--- trunk/libs/asio/test/serial_port.cpp (original)
+++ trunk/libs/asio/test/serial_port.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -119,13 +119,13 @@
     port1.write_some(buffer(mutable_char_buffer), ec);
     port1.write_some(buffer(const_char_buffer), ec);
 
- port1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- port1.async_write_some(buffer(const_char_buffer), write_some_handler);
+ port1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ port1.async_write_some(buffer(const_char_buffer), &write_some_handler);
 
     port1.read_some(buffer(mutable_char_buffer));
     port1.read_some(buffer(mutable_char_buffer), ec);
 
- port1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
+ port1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {

Modified: trunk/libs/asio/test/signal_set.cpp
==============================================================================
--- trunk/libs/asio/test/signal_set.cpp (original)
+++ trunk/libs/asio/test/signal_set.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -67,7 +67,7 @@
     set1.cancel();
     set1.cancel(ec);
 
- set1.async_wait(signal_handler);
+ set1.async_wait(&signal_handler);
   }
   catch (std::exception&)
   {

Modified: trunk/libs/asio/test/windows/overlapped_ptr.cpp
==============================================================================
--- trunk/libs/asio/test/windows/overlapped_ptr.cpp (original)
+++ trunk/libs/asio/test/windows/overlapped_ptr.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -54,14 +54,14 @@
 
     win::overlapped_ptr ptr1;
 
- win::overlapped_ptr ptr2(ios, overlapped_handler_1);
+ win::overlapped_ptr ptr2(ios, &overlapped_handler_1);
     win::overlapped_ptr ptr3(ios, overlapped_handler_2());
 
     // overlapped_ptr functions.
 
     ptr1.reset();
 
- ptr2.reset(ios, overlapped_handler_1);
+ ptr2.reset(ios, &overlapped_handler_1);
     ptr3.reset(ios, overlapped_handler_2());
 
     OVERLAPPED* ov1 = ptr1.get();

Modified: trunk/libs/asio/test/windows/random_access_handle.cpp
==============================================================================
--- trunk/libs/asio/test/windows/random_access_handle.cpp (original)
+++ trunk/libs/asio/test/windows/random_access_handle.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -111,15 +111,15 @@
     handle1.write_some_at(offset, buffer(const_char_buffer), ec);
 
     handle1.async_write_some_at(offset,
- buffer(mutable_char_buffer), write_some_handler);
+ buffer(mutable_char_buffer), &write_some_handler);
     handle1.async_write_some_at(offset,
- buffer(const_char_buffer), write_some_handler);
+ buffer(const_char_buffer), &write_some_handler);
 
     handle1.read_some_at(offset, buffer(mutable_char_buffer));
     handle1.read_some_at(offset, buffer(mutable_char_buffer), ec);
 
     handle1.async_read_some_at(offset,
- buffer(mutable_char_buffer), read_some_handler);
+ buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {

Modified: trunk/libs/asio/test/windows/stream_handle.cpp
==============================================================================
--- trunk/libs/asio/test/windows/stream_handle.cpp (original)
+++ trunk/libs/asio/test/windows/stream_handle.cpp 2011-05-03 20:02:18 EDT (Tue, 03 May 2011)
@@ -109,13 +109,13 @@
     handle1.write_some(buffer(mutable_char_buffer), ec);
     handle1.write_some(buffer(const_char_buffer), ec);
 
- handle1.async_write_some(buffer(mutable_char_buffer), write_some_handler);
- handle1.async_write_some(buffer(const_char_buffer), write_some_handler);
+ handle1.async_write_some(buffer(mutable_char_buffer), &write_some_handler);
+ handle1.async_write_some(buffer(const_char_buffer), &write_some_handler);
 
     handle1.read_some(buffer(mutable_char_buffer));
     handle1.read_some(buffer(mutable_char_buffer), ec);
 
- handle1.async_read_some(buffer(mutable_char_buffer), read_some_handler);
+ handle1.async_read_some(buffer(mutable_char_buffer), &read_some_handler);
   }
   catch (std::exception&)
   {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk