Boost C++ Libraries: Ticket #9000: asio::buffered_stream and family missing rvalue-move support https://svn.boost.org/trac10/ticket/9000 <p> The classes <strong>asio::buffered_read_stream</strong> and <strong>asio::buffered_write_stream</strong> are missing support for rvalue-move for the handler arguments. I can't say I'm truly an expert but for example, I believe that the function definition for <strong>buffered_read_stream::async_read_some</strong> should look like this: </p> <pre class="wiki"> template &lt;typename MutableBufferSequence, typename ReadHandler&gt; void async_read_some(const MutableBufferSequence&amp; buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { if (boost::asio::buffer_size(buffers) == 0) { get_io_service().post(detail::bind_handler( BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), boost::system::error_code(), 0)); } else if (storage_.empty()) { async_fill(read_some_handler&lt;MutableBufferSequence, ReadHandler&gt;( get_io_service(), storage_, buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))); } else { std::size_t length = copy(buffers); get_io_service().post(detail::bind_handler( BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), boost::system::error_code(), length)); } } </pre><p> Note that classes like <strong>asio::basic_stream_socket</strong> all use <strong>BOOST_ASIO_MOVE_ARG</strong> and <strong>BOOST_ASIO_MOVE_CAST</strong> for their treatment of handlers. </p> <p> If I am incorrect please advise me so I can correct my own code because this is the model I am following. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9000 Trac 1.4.3 vinnie.falco@… Wed, 21 Aug 2013 07:47:43 GMT <link>https://svn.boost.org/trac10/ticket/9000#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9000#comment:1</guid> <description> <p> Let me also add that the use of <strong>detail::bind_handler</strong> is obsolete, at least in 1.54. It would be preferable to write: </p> <pre class="wiki">get_io_service ().wrap (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler) (boost::system::error_code(), 0); </pre><p> Furthermore, the return value of calling the functor returned by [b]io_service::wrap<a href="https://svn.boost.org/trac10/b">b</a> should be returned, as it could be a <strong>BOOST_ASIO_INITFN_RESULT_TYPE</strong>: </p> <pre class="wiki">return get_io_service ().wrap (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler) (boost::system::error_code(), 0); </pre><p> But amending <strong>asio::buffered_*_stream</strong> to support future returns is the subject of another ticket... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>chris_kohlhoff</dc:creator> <pubDate>Tue, 01 Oct 2013 09:19:18 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9000#comment:2 https://svn.boost.org/trac10/ticket/9000#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed on trunk in <a class="changeset" href="https://svn.boost.org/trac10/changeset/85798" title="Update buffered stream operations to adhere to current handler patterns. ">[85798]</a>. Merged to release in <a class="changeset" href="https://svn.boost.org/trac10/changeset/85838" title="Merge asio from trunk. ...">[85838]</a>. See also <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9001" title="#9001: Feature Requests: asio::buffered_stream and family missing future returns (closed: fixed)">#9001</a>. </p> Ticket