#pragma once #define BITWISE_OP(enum_type, numeric_type, op) \ enum_type operator op(enum_type lhs, enum_type rhs) noexcept { \ return static_cast(static_cast(lhs) \ op static_cast(rhs)); \ } #define BITWISE_OPS(enum_type, numeric_type) \ BITWISE_OP(enum_type, numeric_type, |) \ BITWISE_OP(enum_type, numeric_type, &) \ BITWISE_OP(enum_type, numeric_type, ^) #define HAS_FLAG(enum_value, flag) (enum_value & flag) == flag #define STRIP_FLAG(enum_value, flag) (enum_value | flag) ^ flag