Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-11-26 08:22:14


At 12:27 AM 11/26/2001, Matt Austern wrote:

>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
>with:
> - 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.)

Exactly!

Unification of bitset, dyn_bitset, and vector<bool> seems within reach, and
seems like an elegant solution to several issues:

* A replacement for vector<bool> which does meet container requirements.
* bitset isn't an STL container.
* bitset users wish both static and dynamic allocation flavors.

--Beman


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