This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re:bool


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]