Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-12 22:34:14


----- Original Message -----
From: "Jeremy Siek" <jsiek_at_[hidden]>

> That's the catch. Many people consider vector<bool> a failure, and it has
> caused people headaches, because it pretends to be a real Container with
> real iterators, but it is not. A dyn_bitset with iterators would be in a
> similar boat. It's iterators could meet the requirements for input
> iterator and output iterator, but not forward iterator, bidirectional, or
> random access because the thing returned by operator* is a proxy, and
> therefore not an lvalue (which is required by Table 74 of the C++
> standard).

It doesn't need to be a proxy. The iterator can store the bool internally
and write back to the container when incremented (or destroyed). It would
also have to keep the container storage alive, of course. That would give
the iterator surprising semantics, but it would be conforming.

-Dave


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