2 // SecTranslocateEnumUtils.h
7 #ifndef SecTranslocateEnumUtils_h
8 #define SecTranslocateEnumUtils_h
10 #include <type_traits>
12 template<typename Enum>
13 Enum operator |(Enum lhs, Enum rhs)
15 static_assert(std::is_enum<Enum>::value,
16 "template parameter is not an enum type");
18 using underlying = typename std::underlying_type<Enum>::type;
20 return static_cast<Enum> (
21 static_cast<underlying>(lhs) |
22 static_cast<underlying>(rhs)
26 template<typename Enum>
27 Enum operator &(Enum lhs, Enum rhs)
29 static_assert(std::is_enum<Enum>::value,
30 "template parameter is not an enum type");
32 using underlying = typename std::underlying_type<Enum>::type;
34 return static_cast<Enum> (
35 static_cast<underlying>(lhs) &
36 static_cast<underlying>(rhs)
40 #endif /* SecTranslocateEnumUtils_h */