I understand it\'s possible to use bitmasks in enum values, but I don\'t know how to create it.
I have a simple enum :
enum State
{
minimizing = 0,
Use a different bit for every value in your enumeration, such as:
enum State
{
minimizing = 0x01, // 00000001
maximizing = 0x02, // 00000010
minimized = 0x04, // 00000100
maximized = 0x08 // 00001000
}:
Then, you can combine multiple values with bitwise or (minimizing | maximized
) and test for values with bitwise and (bool is_minimized = (flags & minimized);
).