On 7/19/06, bringiton bringiton
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