P
Plissken.s
Is there an efficient way to create a struct of flag in C++?
I need to create a struct of boolean flag, like this:
struct testStruct {
bool flag1;
bool flag2;
bool flag3;
bool flag4;
bool flag5;
bool flag6;
bool flag7;
bool flag8;
bool flag9;
bool flag10;
bool flag11;
bool flag12;
bool flag13;
};
But if I do that, i print out the sizeof(), that struct and it is 13.
So i think the compile use 1 byte for each flag.
Is it possible to create a struct so that each flag uses only 1 bit.
Thank you.
I need to create a struct of boolean flag, like this:
struct testStruct {
bool flag1;
bool flag2;
bool flag3;
bool flag4;
bool flag5;
bool flag6;
bool flag7;
bool flag8;
bool flag9;
bool flag10;
bool flag11;
bool flag12;
bool flag13;
};
But if I do that, i print out the sizeof(), that struct and it is 13.
So i think the compile use 1 byte for each flag.
Is it possible to create a struct so that each flag uses only 1 bit.
Thank you.