The simplest way is to provide the operator overloads yourself. I am thinking of creating a macro to expand the basic overloads per type.
#include <type_traits>
enum class SBJFrameDrag
{
None = 0x00,
Top = 0x01,
Left = 0x02,
Bottom = 0x04,
Right = 0x08,
};
inline SBJFrameDrag operator | (SBJFrameDrag lhs, SBJFrameDrag rhs)
{
using T = std::underlying_type_t <SBJFrameDrag>;
return static_cast<SBJFrameDrag>(static_cast<T>(lhs) | static_cast<T>(rhs));
}
inline SBJFrameDrag& operator |= (SBJFrameDrag& lhs, SBJFrameDrag rhs)
{
lhs = lhs | rhs;
return lhs;
}
(Note that type_traitstype_traits is a C++11 header and std::underlying_type_tstd::underlying_type_t is a C++14 feature.)