bool
Andrew Borthwick
borthwic@johnson.cs.nyu.edu
Tue Nov 11 15:29:00 GMT 1997
Per Bothner:
> sizeof(bool) must be one.
> Any other choice will be "unexpected" by reasonable progragrammers.
I totally agree. This behavior was certainly unexpected by me.
> Er - what has sizeof to do with how bits are packed? Obviously, sizeof
> will only tell you the fixed (overhead) size. If you look at
> bit_vector, you will find that it does use 1 bit per bool.
My apologies for a somewhat poor choice of words on the subject of vector<bool>
vs. bit_vector.
I'm still not entirely clear. Am I correct that bit_vector gives me
1 bit per bool but vector<bool> does not? If this is so, couldn't vector be
easily specialized for vector<bool> to give this functionality in a more
standard fashion?
Thanks,
Andrew Borthwick
More information about the Gcc
mailing list