Nitay Joffe wrote: 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
Would you please post the compiler errors?
Thanks, -n
Sure, here is sample code that causes the error: #include <iosfwd> #include <boost/iostreams/categories.hpp> #include <boost/iostreams/stream.hpp> struct MyDevice { typedef char char_type; typedef boost::iostreams::source_tag category; std::streamsize read(char *s, std::streamsize n) { return n; } }; typedef boost::iostreams::stream<MyDevice> MyStream; int main() { MyDevice d; MyStream s(d, (std::streamsize)500); return 0; } And here are the compile errors: g++ a.cc k/usr/include/boost/iostreams/stream.hpp: In constructor 'boost::iostreams::stream<Device, Tr, Alloc>::stream(U100&, const U0&) [with U100 = MyDevice, U0 = std::streamsize, Device = MyDevice, Tr = std::char_traits<char>, Alloc = std::allocator<char>]': a.cc:18: instantiated from here /usr/include/boost/iostreams/stream.hpp:110: error: no matching function for call to 'MyDevice::MyDevice(MyDevice&, const long int&)' a.cc:5: note: candidates are: MyDevice::MyDevice() a.cc:5: note: MyDevice::MyDevice(const MyDevice&) make: *** [all] Error 1 If I change the (std::streamsize) to (int) it compiles. Cheers, -n