Go to the source code of this file.
◆ IMPLEMENT_FLAG_OPERATIONS
#define IMPLEMENT_FLAG_OPERATIONS |
( |
|
E | ) |
|
Value:inline E operator | (E lhs, E rhs) \
{ \
return static_cast<E>( static_cast<int>(lhs) | static_cast<int>(rhs)); \
} \
\
inline E operator & (E lhs, E rhs) \
{ \
return static_cast<E>( static_cast<int>(lhs) & static_cast<int>(rhs)); \
} \
\
inline E operator -= (E& lhs, E rhs) \
{ \
lhs = static_cast<E>( static_cast<int>(lhs) & ~static_cast<int>(rhs)); \
return lhs; \
} \
\
inline bool has_flag(E flags, E test) \
{ \
return (flags & test) == test; \
}
This macro implements operations on a strongly typed enum that is used as a flag. We use a macro since we don't want to provide a template that would be valid for all types that don't have these operators implemented
Definition at line 36 of file flags.hh.