Boost logo

Boost :

Subject: Re: [boost] Any interest in bitstream class?
From: Daryle Walker (darylew_at_[hidden])
Date: 2013-07-01 08:45:26


> Date: Thu, 27 Jun 2013 20:44:19 -0500
> From: plong_at_[hidden]
>
> Same semantics as, e.g., stringstream, but it operates on binary data. I
> already have the analogues to istringstream/stringbuf (you can take a
> look at ibitstream/bitbuf at https://github.com/dplong/bstream) There
> are some interesting features, but I won't go into them here. If there
> is interest, I would implement obitstream and bitstream and possibly
> support Boost::dynamic_bitset.

Looking at the header file "bstream.h"
 
1. Can't "uintmax_t" be used for "bitfield"?
2. Why doesn't "bitbuf" have constructors that take "char *"?
3. The names used for the methods of the Standard text stream family of classes are horrid. Since you're not inheriting from the old classes, can you improve the names? Importantly, the legacy names used "ImportantName" for the protected implementation functions, forcing the use of "pubImportantName" for the user-facing interface. You should reverse them to protected "do_action" and public "action." (The standard locale facets did this fix.)
4. The "ibitstream" class has an "operator !" without a Boolean conversion operator? There's no way to use a stream in a test. You should create an (explicit) "bool" conversion operator. Then you can use a stream in built-in Boolean tests (including "operator!"!). Also, this operator should be moved to the ios_base/basic_ios class when you create it. (Make sure to "using" it in the istream, ostream, and iostream classes.)
 
Daryle W.
 
                                               


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