Enable bitwise operators on scoped enums.
Library compiles with no warnings (-std=c++17 -Wall -Wshadow -Wextra -Wnon-virtual-dtor -pedantic) on Clang 14.
enumclassTestEnum
{
Baz = 1 << 0,
Fou = 1 << 1,
Moo = 1 << 2,
Foo = 1 << 3,
Bar = 1 << 4,
};
template <>
structzsl::EnumFlags<TestEnum>
{
staticconstexprbool is_flags = true;
};
// ...automain() -> int
{
TestEnum e{TestEnum::Baz};
auto b = zsl::EnumIsSet(e & TestEnum::Baz);
std::cout << (b ? "true" : "false");
e = TestEnum::Foo | TestEnum::Baz;
return0;
}