Boost logo

Boost :

Subject: Re: [boost] Any interest in bitstream class?
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-06-30 08:50:20

Paul Long wrote:
>> It could also support some non-C++ formats like 16-bit half precision
>> or 128-bit quad precision floats. Some typedefs would probably be
>> required in namespace boost::bitstream.
> Okay, sure. BTW, ibitstream consumers can easily support new types by
> overloading operator>>. For example, this is how bool is supported:
> ibitstream &operator>>(ibitstream &ibs, bool &b)
> {
> bitfield value;
>, 1);
> b = value != 0;
> return ibs;
> }

Ok, however those would only apply for C++-like types. What if we have
some file which stores 16-bit floats or floats with different radix than
the native one, or even in some other standard? And this is jus a tip of
an iceberg. There is a lot of different ways to describe similar types
to C++ native types. Should the user be forced to e.g. wrap native types
and write overloads? Should those different formats be supported by
bitstream somehow (e.g. by predefined wrappers)? And who should define
how those types in stored and native format should be converted between
each other?


Boost list run by bdawes at, gregod at, cpdaniel at, john at