Skip to content

Commit 6c61a8a

Browse files
committed
Use unsigned char as the underlying type for the tribool state.
This makes sizeof(tribool) == 1, which is similar to sizeof(bool) on most platforms. This is only enabled when C++11 scoped enums are supported.
1 parent ebff10a commit 6c61a8a

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

include/boost/logic/tribool.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ class tribool
131131
* The actual stored value in this 3-state boolean, which may be false, true,
132132
* or indeterminate.
133133
*/
134-
enum value_t { false_value, true_value, indeterminate_value } value;
134+
enum value_t
135+
#if !defined( BOOST_NO_CXX11_SCOPED_ENUMS )
136+
: unsigned char
137+
#endif
138+
{ false_value, true_value, indeterminate_value } value;
135139
};
136140

137141
// Check if the given tribool has an indeterminate value. Also doubles as a

0 commit comments

Comments
 (0)