Boost logo

Boost :

Subject: Re: [boost] Any interest in bitstream class?
From: Paul Long (plong_at_[hidden])
Date: 2013-06-30 12:38:36


On 6/30/2013 8:45 AM, Mathias Gaunard wrote:
> On 30/06/13 05:09, Paul Long wrote:
>> template <size_t N>
>> ibitstream &operator>>(ibitstream &ibs, std::bitset<N> &bs)
>> {
>> decltype(bs.to_ulong()) value;
>> ibs.read(value, N);
>
> That is surprising.
> istream's read takes a char* and a size in bytes.
>
> ibitstream's read takes a unsigned long& and a size in bits!?

The entire class hierarchy to which istream belongs processes sequences
of _characters_--it should really be called icharstream--so of course it
takes a size in bytes. The proposed bitstream library processes
unaligned sequences of bits, so it takes a size in bits. What's surprising?

Paul


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk