2017-01-31 20:25:05 UTC
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
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.