Loading...
Searching...
No Matches
18#define CLINGO_ENABLE_BITSET_ENUM(E, ...) \
19 [[nodiscard]] CLINGO_ENUM_OP(~, (E a), __VA_ARGS__)->E { \
20 return static_cast<E>(~static_cast<std::underlying_type_t<E>>(a)); \
22 [[nodiscard]] CLINGO_ENUM_OP(|, (E a, E b), __VA_ARGS__)->E { \
23 return static_cast<E>(static_cast<std::underlying_type_t<E>>(a) | static_cast<std::underlying_type_t<E>>(b)); \
25 CLINGO_ENUM_OP(|=, (E & a, E b), __VA_ARGS__)->E & { \
28 [[nodiscard]] CLINGO_ENUM_OP(&, (E a, E b), __VA_ARGS__)->E { \
29 return static_cast<E>(static_cast<std::underlying_type_t<E>>(a) & static_cast<std::underlying_type_t<E>>(b)); \
31 CLINGO_ENUM_OP(&=, (E & a, E b), __VA_ARGS__)->E & { \
34 [[nodiscard]] CLINGO_ENUM_OP(-, (E a, E b), __VA_ARGS__)->E { \
35 return static_cast<E>(static_cast<std::underlying_type_t<E>>(a) & static_cast<std::underlying_type_t<E>>(~b)); \
37 CLINGO_ENUM_OP(-=, (E & a, E b), __VA_ARGS__)->E & { \
40 [[nodiscard]] CLINGO_ENUM_OP(^, (E a, E b), __VA_ARGS__)->E { \
41 return static_cast<E>(static_cast<std::underlying_type_t<E>>(a) ^ static_cast<std::underlying_type_t<E>>(b)); \
43 CLINGO_ENUM_OP(^=, (E & a, E b), __VA_ARGS__)->E & { \
46 [[nodiscard]] [[maybe_unused]] inline __VA_ARGS__ constexpr auto intersects(E a, E b) -> bool { \
47 return static_cast<std::underlying_type_t<E>>(a & b) != 0; \
49 static_assert(std::is_enum_v<E>)
52#define CLINGO_ENUM_OP(op, arg, ...) [[maybe_unused]] inline __VA_ARGS__ constexpr auto operator op arg noexcept