Boost logo

Boost :

From: Matt Austern (austern_at_[hidden])
Date: 2001-11-26 12:29:06


Andrei Alexandrescu wrote:
>
> From: "Jeremy Siek" <jsiek_at_[hidden]>
> > On 11/26/01 12:27 AM, "Matt Austern" <austern_at_[hidden]> wrote:
> > > 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.)
> >
> > I would argue against this.
>
> By the way, isn't word airing that std::vector<bool> in its current form is
> likely to be repudiated?

Everybody (for appropriate definitions of "everybody") would like that,
yes. However, I don't think most people would like to eliminate it
entirely. Most people would rather just change std::vector<bool, Allocator>
to bit_vector<Allocator>.

And piggybacking on to this post to address one of Jeremy's concerns...

It's true that the existing vector<bool>::iterator is slow. I don't think
there's any essential reason for that, however. There's no reason that
vector<bool>::iterator should be any slower than element access through an
index. (Trivial proof: an iterator can store an index.)

What does bother me a bit more is the issue of stack vs heap allocation.

                        --Matt


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