5 #ifndef CHI_SUPPORT_FLAGS_HPP 6 #define CHI_SUPPORT_FLAGS_HPP 25 template <
typename Enum>
27 static_assert(std::is_enum<Enum>::value,
"Template argument to flags must be an enum");
34 Flags(Enum e) : mData{
static_cast<decltype(mData)
>(e)} {}
66 explicit operator bool()
const {
return mData != 0; }
95 Flags(
typename std::underlying_type<Enum>::type data) : mData{data} {}
97 typename std::underlying_type<Enum>::type mData = 0;
102 #endif // CHI_SUPPORT_FLAGS_HPP Flags & operator &=(const Flags &rhs)
Bitwise AND assignment.
bool operator==(const Flags &rhs) const
See if one Flags object is equal to the other.
Flags & operator|=(const Flags &rhs)
Bitwise OR assignment.
Flags operator &(const Flags &rhs) const
Bitwise AND.
A template class for type-safe flags.
Flags operator|(const Flags &rhs) const
Bitwise OR.
Flags()=default
Default constructor.
The namespace where chigraph lives.
bool operator!() const
See if one Flags object isn't equal to the other.
Flags(Enum e)
Constructor from an Enum type.
Flags & operator=(const Flags &fl)=default
Copy assignment.