Boost logo

Boost :

From: Matt Austern (austern_at_[hidden])
Date: 2001-11-26 00:27:03

Jeremy Siek wrote:
> About 6 months ago I did an implementation of dynamic and static bitset
> classes where almost all of the functionality was factored into a common
> base class. That could be easily converted into a single class with a policy
> parameter. However, I did not bring that up when talking with Chuck, or for
> submission to Boost, because the C++ standard already has std::bitset, and I
> thought it would be simpler to have something that is a pure addition
> instead of something that replaces what's already there and then also makes
> an extension. Does that make sense?

Actually, I have a slightly different question. (I think I brought this
up when we talked about this in Redmond.)

My question: why do we need both bitset<> and vector<bool>? What are
the real differences?

Except for trivial syntactic issues, here's all I can really come up
 - vector<bool> provides STL iterators and dynamic resizing, and
   bitset doesn't.
 - bitset provides conversion to/from long, simple I/O, and
   bitwise operations. vector<bool> doesn't provide any of
   those things.

Seems to me that we should really be looking at extending vector<bool>,
not extending bitset. A few trivial addons to vector<bool>, and we've
got a class that does everything bitset does and more. (Yeah, I know:
vector<bool> shouldn't be spelled vector<bool>, it should be spelled
bit_vector. Details.)


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