Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-03-09 15:59:18

> So in std we have the static-length bitset which provides "set" operations
> on bits, and we have a dynamic-length vector<bool> which provides
> "container" operations on bits. But what about a dynamic-length class that
> provides efficient "set" operations, or a static-length class that
> provides "container" operations?

Here's how I would approach this: start with vector<bool> and add another
iterator -- over int values. Then adding the efficient set operations is
easy, and it leaves you open to other extensions.

Another approach is to write an iterator adapter that iterates over the bits
of the contained iterator's value. I started something like this a while
ago, but it was never finished. Also, the container operations are really
tricky; my class only provided read access.

> Anyone else ever felt the need for these capabilities?

Actually (I'm ashamed to admit this...) the only time I needed fast set
operations with dynamic-length, I just used a vector of ints and pretended
they were bool's. Wasteful in space, but it worked for that particular


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