Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename _Enum>
- struct define_bitwise_ops
- {
- using value_type = _Enum;
- using basic_type = std::underlying_type_t<_Enum>;
- friend constexpr value_type operator | (value_type a, value_type b)
- {
- return static_cast<value_type> (static_cast<basic_type>(a)|static_cast<basic_type>(b));
- }
- friend constexpr value_type operator & (value_type a, value_type b)
- {
- return static_cast<value_type> (static_cast<basic_type>(a)&static_cast<basic_type>(b));
- }
- friend constexpr value_type operator ^ (value_type a, value_type b)
- {
- return static_cast<value_type> (static_cast<basic_type>(a)^static_cast<basic_type>(b));
- }
- friend constexpr value_type operator ~ (value_type a)
- {
- return static_cast<value_type> (~static_cast<basic_type>(a));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement