"PKH" <no************@online.no> wrote in message
news:VM********************@news4.e.nsc.no...
"Jonathan Turkanis" <te******@kangaroologic.com> wrote in message
news:31*************@uni-berlin.de...
"Jonathan Turkanis" <te******@kangaroologic.com> wrote:
namespace flags {
const int flag1 = 1;
const int flag2 = flag1 << 1;
const int flag3 = flag2 << 1;
....
}
int flags;
Whoops! I meant
int flags_;
Jonathan
One technique I read in the faq that is nice if you have more flags than can
fit into an integer datatype :
http://www.parashift.com/c++-faq-lite/ctors.html [10.17] What is the "Named
Parameter Idiom"?
David Abrahams and Daniel Wallin have a nice library which allows name
parameters, using syntax like:
Dog* d = new Dog(age = 3, weight = 45.1);
It was just reviewed for inclusion in Boost; the result is pending.
I don't really see the connection between this and bit flags, though.
Jonathan