Seems like it has issues with the stream being passed into async_write as const.

---------
Robert Dailey


On Tue, Aug 25, 2009 at 5:41 PM, Robert Dailey <rcdailey@gmail.com> wrote:
Hello,

I have a std::istream that I pass into a function that calls async_write. Currently here is what I have:

void SerialClient::DoWrite( std::istream const& data )
{
  boost::asio::async_write(
    m_port,
    boost::asio::buffer( data.rdbuf() ),
    boost::bind( &SerialClient::WriteCompleted, this, boost::asio::placeholders::error )
    );
}

Obviously this does not compile. There is no overload of buffer() that takes a streambuf. How can I get asio to write out my stream?


---------
Robert Dailey