This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re:bool
- To: egcs at cygnus dot com
- Subject: Re:bool
- From: Andrew Borthwick <borthwic at johnson dot cs dot nyu dot edu>
- Date: Tue, 11 Nov 1997 18:28:44 -0500 (EST)
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