20#define _LIEF_EN(N) class N : size_t
21#define _LIEF_EN_2(N, TYPE) class N : TYPE
24#define ENABLE_BITMASK_OPERATORS(X) \
26struct EnableBitMaskOperators<X> \
28 static const bool bit_mask_enabled = true; \
31template<
typename Enum>
37template<
typename Enum>
38typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled, Enum>::type
41 using underlying =
typename std::underlying_type<Enum>::type;
42 return static_cast<Enum
> (
43 static_cast<underlying
>(lhs) |
44 static_cast<underlying
>(rhs)
48template<
typename Enum>
49typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled, Enum>::type
52 using underlying =
typename std::underlying_type<Enum>::type;
53 return static_cast<Enum
> (
54 static_cast<underlying
>(lhs) &
55 static_cast<underlying
>(rhs)
59template<
typename Enum>
60typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled, Enum>::type
63 using underlying =
typename std::underlying_type<Enum>::type;
64 return static_cast<Enum
>(~static_cast<underlying>(e));
67template<
typename Enum>
68typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled,
typename std::add_lvalue_reference<Enum>::type>::type
71 using underlying =
typename std::underlying_type<Enum>::type;
72 lhs =
static_cast<Enum
>(
static_cast<underlying
>(lhs) |
static_cast<underlying
>(rhs));
76template<
typename Enum>
77typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled,
typename std::add_lvalue_reference<Enum>::type>::type
80 using underlying =
typename std::underlying_type<Enum>::type;
81 lhs =
static_cast<Enum
>(
static_cast<underlying
>(lhs) &
static_cast<underlying
>(rhs));
85template<
typename Enum>
86typename std::enable_if<EnableBitMaskOperators<Enum>::bit_mask_enabled,
bool>::type
89 using underlying =
typename std::underlying_type<Enum>::type;
90 return static_cast<underlying
>(e) > 0;
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, bool >::type is_true(Enum e)
Definition enums.hpp:87
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, Enum >::type operator|(Enum lhs, Enum rhs)
Definition enums.hpp:39
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, Enum >::type operator&(Enum lhs, Enum rhs)
Definition enums.hpp:50
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, typenamestd::add_lvalue_reference< Enum >::type >::type operator&=(Enum &lhs, Enum rhs)
Definition enums.hpp:78
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, typenamestd::add_lvalue_reference< Enum >::type >::type operator|=(Enum &lhs, Enum rhs)
Definition enums.hpp:69
std::enable_if< EnableBitMaskOperators< Enum >::bit_mask_enabled, Enum >::type operator~(Enum e)
Definition enums.hpp:61
static const bool bit_mask_enabled
Definition enums.hpp:34