stlab-enum-ops 1.1.0
Type-safe operators for enums
Loading...
Searching...
No Matches
Arithmetic Operations

Arithmetic operations for arithmetic-enabled enums. More...

Functions

template<class T>
constexpr auto operator+ (T a) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T >
 Unary plus for arithmetic-enabled enums.
template<class T>
constexpr auto operator+ (T lhs, T rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T >
 Addition for arithmetic-enabled enums.
template<class T>
constexpr auto operator- (T lhs, T rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T >
 Subtraction for arithmetic-enabled enums.
template<class T, class U>
constexpr auto operator* (T lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T >
 Multiplication by a scalar value.
template<class U, class T>
constexpr auto operator* (U lhs, T rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T >
 Multiplication by a scalar value.
template<class T, class U>
constexpr auto operator/ (T lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T >
 Division by a scalar value.
template<class T, class U>
constexpr auto operator% (T lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T >
 Modulo by a scalar value.
template<class T>
constexpr auto operator+= (T &lhs, T rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T & >
 Addition assignment for arithmetic-enabled enums.
template<class T>
constexpr auto operator-= (T &lhs, T rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T & >
 Subtraction assignment for arithmetic-enabled enums.
template<class T, class U>
constexpr auto operator*= (T &lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T & >
 Multiplication assignment by a scalar value.
template<class T, class U>
constexpr auto operator/= (T &lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T & >
 Division assignment by a scalar value.
template<class T, class U>
constexpr auto operator%= (T &lhs, U rhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T > &&stlab::is_compatible_scalar< U, T >, T & >
 Modulo assignment by a scalar value.
template<class T>
constexpr auto operator++ (T &lhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T & >
 Prefix increment for arithmetic-enabled enums.
template<class T>
constexpr auto operator++ (T &lhs, int) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T >
 Postfix increment for arithmetic-enabled enums.
template<class T>
constexpr auto operator-- (T &lhs) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T & >
 Prefix decrement for arithmetic-enabled enums.
template<class T>
constexpr auto operator-- (T &lhs, int) -> std::enable_if_t< stlab::has_enabled_arithmetic< T >, T >
 Postfix decrement for arithmetic-enabled enums.

Detailed Description

Arithmetic operations for arithmetic-enabled enums.

These operations are available when you enable arithmetic operations by defining:

auto stlab_enable_arithmetic_enum(YourEnum) -> std::true_type;