Which is the best way for holding flags?
From: loquak (liam_parc_at_hotmail.com)
Date: 11/30/04
- Next message: Larry Brasfield: "Re: Please help with File IO"
- Previous message: Ali Çehreli: "Re: returning a vector from a funciton"
- Next in thread: Jonathan Turkanis: "Re: Which is the best way for holding flags?"
- Reply: Jonathan Turkanis: "Re: Which is the best way for holding flags?"
- Reply: Gianni Mariani: "Re: Which is the best way for holding flags?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 03:33:05 +0200
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?
- Next message: Larry Brasfield: "Re: Please help with File IO"
- Previous message: Ali Çehreli: "Re: returning a vector from a funciton"
- Next in thread: Jonathan Turkanis: "Re: Which is the best way for holding flags?"
- Reply: Jonathan Turkanis: "Re: Which is the best way for holding flags?"
- Reply: Gianni Mariani: "Re: Which is the best way for holding flags?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|