stlab-enum-ops 1.1.0
Type-safe operators for enums
|
enum_ops
provides optional typesafe bitset and arithmetic operations for enumeration types. Without these typesafe operations, the compiler will promote the operand(s) to the appropriate integral type, and the result will be an integral type. When the typesafe operations have been defined for an enumeration type, E
, the result will be of type E
exactly when the operand(s) are of type E
.
Functions to enable typesafe operations for enum types.
These functions must be overloaded in your enum's namespace to enable the corresponding operations for your enum type.
Bitwise operations for bitmask-enabled enums.
These operations are available when you enable bitmask operations by defining:
Arithmetic operations for arithmetic-enabled enums.
These operations are available when you enable arithmetic operations by defining:
Operations available for both bitmask and arithmetic-enabled enums.
These operations are available for enums that have either bitmask or arithmetic operations enabled.
Defined in stlab/enum_ops.hpp
The following is an example of code that will compile:
The following is contains an example of code that will not compile since the typesafe operators have not been defined.