-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Paul Long Sent: Saturday, June 29, 2013 12:19 AM To: boost@lists.boost.org Subject: Re: [boost] Any interest in bitstream class?
- how do you overload operator>> or operator<< for your stream? I'm not sure what you mean by "how." To date, I have only implemented the input side and so haven't overloaded operator<<. For operator>>, I have overloaded it for various right-hand parameters, including integrals and a few stream manipulators, such as aligng(). The left hand is always an ibitstream reference (which will be extended to bitstream and obitstream references once I support output streams). How do you avoid conflicts with text-based overloads? Maybe I misunderstand your question, but I'm not even aware of how there can be a conflict. Since
- what does writing an int to a stream actually do? Is it the same behaviour as write(&i, sizeof(int)), or does it translate the int to big-endian first? Effectively the latter. It does not assume any particular endianness of the platform (for example, it does not blindly copy platform memory to the bit stream) and therefore does not actually "translate" between endians. The effect, however, is that integrals in the bit stream are always big endian and integrals on
On 6/28/2013 3:32 PM, Mathias Gaunard wrote: these operators are overloaded with left hand of bitstream, ibitstream, or obitstream, they cannot be applied to the std::iostream derivatives. Is that what you mean? the platform are always their native endian. That said, awareness of platform endianness could inform future optimizations.
Don't forget that a Boost.Endian library exists and has been accepted - even if the final implementation has been delayed by Beman being busy with C++11 standards work. Docs are here http://boost.cowic.de/rc/endian/doc/ I have no idea if this is relevant to the bitstream library and endian streams. Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com