Subject: Re: [boost] Any interest in bitstream class?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-06-30 09:45:48
On 30/06/13 05:09, Paul Long wrote:
> On 6/29/2013 12:40 PM, Mathias Gaunard wrote:
>> What should I do if I want to define the operators on my own
>> user-defined type?
> Write them. It should be easy. For example, this is all it takes for
> ibitstream to support std::bitset:
> 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!?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk