52#define ENABLE_BITMASK_OPERATORS(x) \
54 struct enable_bitmask_operators<x> \
56 static const bool enable = true; \
61typename std::enable_if<enable_bitmask_operators<E>::enable, E>::type
operator|(E lhs, E rhs)
63 typedef typename std::underlying_type<E>::type underlying;
64 return static_cast<E
>(
static_cast<underlying
>(lhs) |
static_cast<underlying
>(rhs));
68typename std::enable_if<enable_bitmask_operators<E>::enable, E>::type
operator&(E lhs, E rhs)
70 typedef typename std::underlying_type<E>::type underlying;
71 return static_cast<E
>(
static_cast<underlying
>(lhs) &
static_cast<underlying
>(rhs));
75typename std::enable_if<enable_bitmask_operators<E>::enable, E>::type
operator^(E lhs, E rhs)
77 typedef typename std::underlying_type<E>::type underlying;
78 return static_cast<E
>(
static_cast<underlying
>(lhs) ^
static_cast<underlying
>(rhs));
82typename std::enable_if<enable_bitmask_operators<E>::enable, E>::type
operator~(E lhs)
84 typedef typename std::underlying_type<E>::type underlying;
85 return static_cast<E
>(~static_cast<underlying>(lhs));
89typename std::enable_if<enable_bitmask_operators<E>::enable, E&>::type
operator|=(E& lhs, E rhs)
91 typedef typename std::underlying_type<E>::type underlying;
92 lhs =
static_cast<E
>(
static_cast<underlying
>(lhs) |
static_cast<underlying
>(rhs));
97typename std::enable_if<enable_bitmask_operators<E>::enable, E&>::type
operator&=(E& lhs, E rhs)
99 typedef typename std::underlying_type<E>::type underlying;
100 lhs =
static_cast<E
>(
static_cast<underlying
>(lhs) &
static_cast<underlying
>(rhs));
105typename std::enable_if<enable_bitmask_operators<E>::enable, E&>::type
operator^=(E& lhs, E rhs)
107 typedef typename std::underlying_type<E>::type underlying;
108 lhs =
static_cast<E
>(
static_cast<underlying
>(lhs) ^
static_cast<underlying
>(rhs));
std::enable_if< enable_bitmask_operators< E >::enable, E >::type operator~(E lhs)
std::enable_if< enable_bitmask_operators< E >::enable, E >::type operator^(E lhs, E rhs)
std::enable_if< enable_bitmask_operators< E >::enable, E & >::type operator&=(E &lhs, E rhs)
std::enable_if< enable_bitmask_operators< E >::enable, E & >::type operator|=(E &lhs, E rhs)
std::enable_if< enable_bitmask_operators< E >::enable, E >::type operator&(E lhs, E rhs)
std::enable_if< enable_bitmask_operators< E >::enable, E >::type operator|(E lhs, E rhs)
std::enable_if< enable_bitmask_operators< E >::enable, E & >::type operator^=(E &lhs, E rhs)