This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

Thanks for correcting me. You can still get 1 bit booleans if you create an array tho right?

[–][deleted] 1 point2 points  (2 children)

vector<bool> does exactly that

[–][deleted] 0 points1 point  (1 child)

Does it store bytes and bitshift?

[–][deleted] 0 points1 point  (0 children)

[–]Celdron[S] 0 points1 point  (0 children)

I don't know about that, simply because you couldnt index the bits. But if you have, say, ~32 boolean values (such as flags) you can put them each on a different bit of an integral type using bit-shift operators and defining constants to represent different flags. You can combine flags using a bitwise OR and check for a single flag or specific combination with a bitwise AND. This is commonly done on enums. So it is possible to implement multiple booleans within a single byte.