Subject: [Boost-bugs] [Boost C++ Libraries] #9000: asio::buffered_stream and family missing rvalue-move support
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-16 07:41:53
#9000: asio::buffered_stream and family missing rvalue-move support
-------------------------------+----------------------------
Reporter: vinnie.falco@⦠| Owner: chris_kohlhoff
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: asio
Version: Boost 1.54.0 | Severity: Optimization
Keywords: rvalue references |
-------------------------------+----------------------------
The classes '''asio::buffered_read_stream''' and
'''asio::buffered_write_stream''' 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
'''buffered_read_stream::async_read_some''' should look like this:
{{{
template <typename MutableBufferSequence, typename ReadHandler>
void async_read_some(const MutableBufferSequence& 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<MutableBufferSequence, ReadHandler>(
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));
}
}
}}}
Note that classes like '''asio::basic_stream_socket''' all use
'''BOOST_ASIO_MOVE_ARG''' and '''BOOST_ASIO_MOVE_CAST''' for their
treatment of handlers.
If I am incorrect please advise me so I can correct my own code because
this is the model I am following.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9000> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC