Boost logo

Boost Users :

Subject: [Boost-users] [Asio] Problem with streambuf example code
From: Dylan Klomparens (dylan.klomparens_at_[hidden])
Date: 2009-10-26 11:36:11


Hello,

I've attempted to compile a portion of the example source code for the Asio
streambuf class. The code attempts to convert a streambuf to a
const_buffers_type, to be used in receiving data from a UDP socket. The
example can be found at "
http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/reference/streambuf.html".
The code in question is as follows:

boost::asio::streambuf b;
// reserve 512 bytes in output sequence
boost::asio::streambuf::const_buffers_type bufs = b.prepare(512);

For simplicity, I tried compiling only these two lines but I receive this
compilation error:
error C2440: 'initializing' : cannot convert from
'boost::asio::basic_streambuf<>::mutable_buffers_type' to
'boost::asio::const_buffers_1'

Am I missing something obvious? It's my understanding that mutable buffers
can always be converted to constant buffers. Why is the second line
problematic?

-- Dylan



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net