![]() |
ToyGine2 26.2.0
Game Engine for retro consoles
|
Opt-in bitwise operators for scoped enumerations used as flag sets. More...
Go to the source code of this file.
Classes | |
| class | toy::EnableBitwiseOperators< T > |
| Primary template: disables generic bitwise operators for T unless specialized. More... | |
Namespaces | |
| namespace | toy |
| Root namespace containing all engine modules. | |
Macros | |
| #define | ENABLE_BITWISE_OPERATORS(T) |
Specializes toy::EnableBitwiseOperators so that enable is true for the scoped enum T. | |
Functions | |
| template<typename T> | |
| constexpr T | toy::operator| (T lhs, T rhs) noexcept |
| Computes bitwise OR on the underlying integers, then casts back to T. | |
| template<typename T> | |
| constexpr T | toy::operator& (T lhs, T rhs) noexcept |
| Computes bitwise AND on the underlying integers, then casts back to T. | |
| template<typename T> | |
| constexpr T | toy::operator^ (T lhs, T rhs) noexcept |
| Computes bitwise XOR on the underlying integers, then casts back to T. | |
| template<typename T> | |
| constexpr T | toy::operator~ (T lhs) noexcept |
| Computes bitwise NOT of the underlying integer, then casts back to T. | |
| template<typename T> | |
| constexpr T & | toy::operator|= (T &lhs, T rhs) noexcept |
| Compound OR: lhs becomes lhs | rhs. | |
| template<typename T> | |
| constexpr T & | toy::operator&= (T &lhs, T rhs) noexcept |
| Compound AND: lhs becomes lhs & rhs. | |
| template<typename T> | |
| constexpr T & | toy::operator^= (T &lhs, T rhs) noexcept |
| Compound XOR: lhs becomes lhs ^ rhs. | |
Opt-in bitwise operators for scoped enumerations used as flag sets.
Defines toy::EnableBitwiseOperators and constrained operator overloads.
| #define ENABLE_BITWISE_OPERATORS | ( | T | ) |
Specializes toy::EnableBitwiseOperators so that enable is true for the scoped enum T.
The macro expands to a full class template specialization in namespace toy. Place it in the global namespace after T is complete so the specialization is visible when instantiating the generic operators.
| T | The scoped enumeration type (may be qualified with its namespace). |