Re: Comparing two vectors of bools
On Aug 3, 12:27 pm, "Bo Persson" <b...@gmb.dk> wrote:
James Kanze wrote:
On Aug 2, 12:13 pm, "Bo Persson" <b...@gmb.dk> wrote:
It also uses a proxy class for vector<bool>::reference,
which is not allowed by the standard for any other
container.
Again: bitset.
Yes, I forgot about that one. :-)
It claims to be an associative container, but doesn't have the
required interface.
And shouldn't have. Basically, the requirements for containers
don't really mean anything; it doesn't start becoming serious
until you consider the requirements for sequence.
[...]
The contract is cracking up anyway, as the revisions for the
next standard introduces new containers and new requirements
that just don't go well together.
The problem is that the original specifications aren't really
well designed. They work (more or less) for the containers that
were present in the original standard (with the exception of
bitset), but they aren't nearly flexible enough to cover all, or
even most, of the useful cases.
Just like bitset is (supposedly) an associative container with
a fixed size (and therefore has a non-conforming different
interface), C++0x introduces a std::array as a fixed size
sequence container which cannot implement insert and erase,
for example. We also have basic_string claiming to be a
sequence container, but falling short.
basic_string should be fixed so that it is a sequence.
Otherwise, however, I don't see anything wrong with introducing
containers which aren't sequences, and it seems obvious (to me,
anyways) that the basic concepts need working on: ) there should
be a distinction in the notion of mutable---you need containers
whose values can be modified, but whose topology is fixed (like
tr1::array), for example, and there are more than a few problems
with the iterators: why, for example, should an iterator into a
non-mutable sequence still require operator* to return a
reference, rather than a value? Or for that matter, why not
rework the concepts to allow proxies in general?
In comparison, vector<bool> seems like a minor problem. .-)
The problem isn't that it exists. The problem is that it is an
std::vector, and not something else.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34