Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-02-28 17:23:59


On second thought, even though I've found the operators they don't do what I
expected them to do in my tests. So, I have the following stream, which is a
seekable device:

boost::iostreams::stream<MyStreamDevice> IOStream;

void foo()
{
    char data;
    IOStream >> data;
}

I expected here that MyStreamDevice::read() would be called with a request
for 1 byte, since the sizeof( data ) is 1 byte. I want my stream to act as
binary, so the bitshift operators should attempt to "fill" the right operand
with as much as it can. For longs, this would be 4 bytes for example.

Do I have to overload my own generic bitshift operators for this behavior or
does Boost.Iostreams supply some overloaded bitshift operators that provide
such functionality?

On Thu, Feb 28, 2008 at 3:54 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:

> Sorry, I posted too early, I found the answer in the documentation. I was
> looking around forever and I couldn't find it :)
>
>
> On Thu, Feb 28, 2008 at 3:53 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:
>
> > Does the Boost.Iostreams library have overloaded bitshift operators?
> > That way I could do:
> >
> > boost::iostreams::stream<myclass> theOutputStream;
> > theOutputStream << MyData;
> >
>
>



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