Enum-based flags example
#include <iostream>
enum class MyFlags
{
None = 0x0,
One = 0x1,
Two = 0x2,
Three = 0x4,
Four = 0x8
};
int main(int argc, char** argv)
{
auto mask = MyFlags::One | MyFlags::Two | MyFlags::Three;
if (mask & MyFlags::One)
std::cout << "MyFlags::One is set" << std::endl;
if (mask & MyFlags::Two)
std::cout << "MyFlags::Two is set" << std::endl;
if (mask & MyFlags::Three)
std::cout << "MyFlags::Three is set" << std::endl;
if (mask & MyFlags::Four)
std::cout << "MyFlags::Four is set" << std::endl;
return 0;
}
Enum-based flags definition.
#define ENUM_FLAGS(type)
Register a new enum-based flags macro.