I\'m looking to use a set of bit flags for my current issue. These flags are (nicely) defined as part of an enum, however I understand that when you OR
enum
OR
If you think about type safety, it is better to use std::bitset
enum BITS { A, B, C, D }; std::bitset<4> bset, bset1; bset.set(A); bset.set(C); bset1[B] = 1; assert(bset[A] == bset[C]); assert(bset[A] != bset[B]); assert(bset1 != bset);