AUI_ENUM_FLAG#
Make a bitfield-style enum class.
Header: | #include <AUI/Reflect/AEnumerate.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Definition#
#define AUI_ENUM_FLAG(name) enum class name: int; \
constexpr inline name operator|(name a, name b) {return static_cast<name>(static_cast<int>(a) | static_cast<int>(b));} \
constexpr inline name operator&(name a, name b) {return static_cast<name>(static_cast<int>(a) & static_cast<int>(b));} \
constexpr inline name operator^(name a, name b) {return static_cast<name>(static_cast<int>(a) ^ static_cast<int>(b));} \
constexpr inline name operator|=(name& a, name b) {return a = static_cast<name>(static_cast<int>(a) | static_cast<int>(b));} \
constexpr inline name operator&=(name& a, name b) {return a = static_cast<name>(static_cast<int>(a) & static_cast<int>(b));} \
constexpr inline name operator^=(name& a, name b) {return a = static_cast<name>(static_cast<int>(a) ^ static_cast<int>(b));} \
constexpr inline name operator~(const name& a) {return static_cast<name>(~static_cast<int>(a));} \
constexpr inline bool operator!(const name& a) {return a == static_cast<name>(0);} \
\
constexpr inline bool operator&&(const name& a, bool v) {return static_cast<int>(a) && v;} \
constexpr inline bool operator||(const name& a, bool v) {return static_cast<int>(a) || v;} \
\
enum class name: int
Examples#
examples/app/minesweeper/src/FieldCell.h
Minesweeper Game - Minesweeper game implementation driven by ass.