Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-11-26 14:37:17


On 11/26/01 12:29 PM, "Matt Austern" <austern_at_[hidden]> wrote:
> 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.)

The vector<bool>::iterator always has to to bit twiddling on dereference. So
my point is that if you want to do something to all the bits in a bitset,
you should do it a word at a time, not a bit at a time. This is why I don't
like iterators over individual bits.

Cheers,
Jeremy

-- 
Jeremy Siek                          http://www.osl.iu.edu/~jsiek
Ph.D. Student, Indiana Univ. B'ton   email: jsiek_at_[hidden]
C++ Booster (http://www.boost.org)   office phone: (812) 855-3608

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