16 static const bool enable =
false;
19template <
typename Enum>
20typename std::enable_if<EnableBitMaskOperators<Enum>::enable,
22operator|(Enum lhs, Enum rhs) {
23 using Underlying =
typename std::underlying_type<Enum>::type;
24 return static_cast<Enum
>(
static_cast<Underlying
>(lhs) |
25 static_cast<Underlying
>(rhs));
28template <
typename Enum>
29typename std::enable_if<EnableBitMaskOperators<Enum>::enable,
31operator&(Enum lhs, Enum rhs) {
32 using Underlying =
typename std::underlying_type<Enum>::type;
33 return static_cast<Enum
>(
static_cast<Underlying
>(lhs) &
34 static_cast<Underlying
>(rhs));
37template <
typename Enum>
38typename std::enable_if<EnableBitMaskOperators<Enum>::enable,
41 using Underlying =
typename std::underlying_type<Enum>::type;
42 return static_cast<Enum
>(~static_cast<Underlying>(e));
45template <
typename Enum>
46typename std::enable_if<EnableBitMaskOperators<Enum>::enable,
49 using Underlying =
typename std::underlying_type<Enum>::type;
50 return static_cast<Enum
>(!
static_cast<Underlying
>(e));
53#define ENABLE_BITMASK_OPERATORS(x) \
54 template <> struct EnableBitMaskOperators<x> { \
55 static const bool enable = true; \