Boost logo

Boost Users :

From: me22 (me22.ca_at_[hidden])
Date: 2006-07-19 10:52:17


On 7/19/06, bringiton bringiton <kneeride_at_[hidden]> wrote:
> I'm wondering whether boost has binary streams (or whether the
> standard library does and i missed it).
>
Neither boost nor the standard library has support for portable binary
serialisation, afaik.

I understand it to be bad style to use << and >> for anything other
than textual representation, so I don't think your approach is the
best. I did experiment with using < and > for binary I/O once, but
handling endianness and lengths and such made it a bit of a mess and
it wasn't header-only.

One thing you might be interested in is Beman's proposed Boost.Endian
library, available in the vault :
http://www.boost-consulting.com/vault/index.php?directory=Integer .
Though not quite as simple as the interface you mention, it does a
better job of handling some of the trickier points. Of course it only
works for integers, but you can build binary I/O for everything else
out of those, pretty much.

> I may use asio when it is avail in the next boost release. does that
> support binary streams?
>
ASIO does have an iostream with a socket backend, but it's a stream
like any other, not a special "binary" one. The above-mentioned
library will work fine with it, however.

~ Scott McMurray


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