Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost iostreams for binary data
From: Robert Dailey (rcdailey.lists_at_[hidden])
Date: 2017-02-02 21:07:51


On Tue, Jan 31, 2017 at 2:25 PM, Robert Dailey <rcdailey.lists_at_[hidden]> wrote:
> I have my own BinaryInputStream and BinaryOutputStream classes that
> simply take a reference to some container that meets the requirements
> of random access and contiguous internal memory. It doesn't own this
> container, but rather serves as an adapter to the container to allow
> stream operators to be used for streaming out data. For example, you
> can stream a `std::uint32_t` to the binary stream, and it will insert
> 4 elements into an internal byte vector which is just
> `std::vector<std::uint8_t>`.
>
> I did not implement these in terms of IO streams, because those seemed
> a bit overkill and make a lot of assumptions on the data being
> text-only. Also I can't stream binary data into vectors, lists, and
> other containers because the data simply can't be parsed. Each stream
> out of a binary vector must be done so with a finite count of bytes.
>
> Would it make sense to implement these objects in terms of the
> IOstream facilities provided by boost? I know these were designed to
> make defining stream classes easier, but honestly I don't have a lot
> of experience with them.
>
> Any feedback on this? Thanks in advance. I can provide some example
> code if needed.

Could I get any advice on this? If I was too vague, please let me know.


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