L
loquak
Greets.
I wonder which way would be the best for holding some state flags in terms
of memory use and efficiency.
a)
struct FLAGS
{
bool flag1 : 1;
bool flag2 : 1;
bool flag3 : 1;
....
}
FLAGS flags;
b)
enum FLAGS
{
flag1,
flag2,
flag3
....
}
std::bitset<FLAGS> flags;
c)
bool flag1;
bool flag2;
bool flag3;
....
Which way would you prefer?
I wonder which way would be the best for holding some state flags in terms
of memory use and efficiency.
a)
struct FLAGS
{
bool flag1 : 1;
bool flag2 : 1;
bool flag3 : 1;
....
}
FLAGS flags;
b)
enum FLAGS
{
flag1,
flag2,
flag3
....
}
std::bitset<FLAGS> flags;
c)
bool flag1;
bool flag2;
bool flag3;
....
Which way would you prefer?