Boost logo

Boost Users :

From: Nitay Joffe (nitay_at_[hidden])
Date: 2008-02-25 19:58:26


Hey guys,

I'm working with the boost::iostreams library to create a stream object from
a Device class I've implemented. I'm trying to call the constructor that
allows setting of the buffer size and it is failing to compile on 64 bit.

I used the documenation at
http://www.boost.org/libs/iostreams/doc/guide/generic_streams.html#stream

The docs say the constructor is of the form:

stream(const T& t,
       std::streamsize buffer_size = default_value,
       std::streamsize pback_size = default_value);

My code to create the stream looks like:

MyDevice myDevice(...)
MyStream(myDevice, (std::streamsize)500);

On a 32 bit machine this works fine, but on a 64 bit one it does not
compile. The parameters I'm passing in are not matching up with a
constructor in the stream class so it tries to call MyDevice with the wrong
set of parameters. I believe the culprit is the file
iostreams/detail/push_params.hpp, which defines the buffer and pback size
using:

#define BOOST_IOSTREAMS_PUSH_PARAMS() \
    , int buffer_size = -1 , int pback_size = -1 \
    /**/

This macro is then used by stream and friends in their constructor
declarations. On 64 bit machines std::streamsize is a long int, so the
constructor parameters do not match up and compilation fails.

Thanks,
-n


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