Boost C++ Libraries: Ticket #7659: sizeof(tribool) > sizeof(bool) * 2 https://svn.boost.org/trac10/ticket/7659 <p> I was wondering why tribool is 4 times larger than a simple bool (tested with msvc10 in 32bit and g++ 4.6.2 on 64bit). By looking at the sourcecode I am suspecting the internal enum always gets compiled as a 4byte int. When using the similar boost::optional&lt;bool&gt; I get at least as good as the naive implementation using two bools, but actually I was expecting a class tribool to be sizeof(bool) *and* encode the third value in the 7 unused bits of the single bool member field. </p> <p> If this has been a design decision I think this is a decision that should be documented. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7659 Trac 1.4.3 James E. King, III Sat, 13 Oct 2018 02:44:29 GMT owner changed https://svn.boost.org/trac10/ticket/7659#comment:1 https://svn.boost.org/trac10/ticket/7659#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">James E. King, III</span> </li> </ul> Ticket James E. King, III Sat, 13 Oct 2018 02:46:18 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7659#comment:2 https://svn.boost.org/trac10/ticket/7659#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> The class was created before C++11 scoped enums where it would have been possible to make this a single byte or even 2 bits. As such, given the age of this request and the length of time the class has been around, the need for backwards compatibility, and the relative disinterest in the ticket, I am closing this out. </p> Ticket