Boost logo

Boost :

From: Chuck Allison (cda_at_[hidden])
Date: 2002-06-11 00:32:47


> > No iterators!
> >
> > Part of the motivation for dyn_bitset (imho) is to give clients of
> > vector<bool> a place to migrate to so that we can deprecate
> > vector<bool>. Therefore dyn_bitset must support the vector<bool>
> > interface at least to a large extent, if not completely. Having it also
> > support the bitset interface is a good thing too. I think both could
> > use iterators, begin, end, rbegin, rend, etc. dyn_bitset could also use
> > the rest of the vector interface: insert, erase, front, back, etc. I
> > would drop append (neither bitset nor vector). In short, I would start
> > with the interface of std::vector<bool> and add to it as appropriate
> > from std::bitset.
>
> The problem with iterators over bits is that they are slow. It seems to me
> like putting iterators in the bitset is just tempting users to actually
> use them, when in most situations they shouldn't. If the user wants to
> iterator over stuff, they probably should look to vector<char> or
> something similar instead.

But isn't it still an issue that you can't fulfill all of the iterator requirements because a bit is not addressable? In other words, iterators must allow:

T* p = &*v.begin();

Can we do this with dyn_bitset?



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