Unary minus operators
Declared in <mp-units/utility/constrained.h>
Negates the wrapped value
[[nodiscard]]
constexpr
constrained<decltype(-std::declval<T>()), ErrorPolicy>
operator-(constrained const& x);
» more...
Computes the difference of lhs and rhs.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator-(
safe_int lhs,
safe_int rhs);
» more...
Subtracts a safe_int from an integral scalar, checking for overflow.
template<typename U>
requires (detail::integral<U> && detail::same_sign_v<U, T>)
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator-(
U lhs,
safe_int rhs);
» more...
Subtracts a safe_int from a floating-point value.
template<typename U>
requires treat_as_floating_point<U>
[[nodiscard]]
constexpr
auto
operator-(
U lhs,
safe_int rhs)
requires requires { lhs - static_cast<U>(rhs.value_); };
» more...
Subtracts an integral scalar from a safe_int, checking for overflow.
template<typename U>
requires (detail::integral<U> && detail::same_sign_v<T, U>)
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator-(
safe_int lhs,
U rhs);
» more...
Subtracts a floating-point value from a safe_int.
template<typename U>
requires treat_as_floating_point<U>
[[nodiscard]]
constexpr
auto
operator-(
safe_int lhs,
U rhs)
requires requires { static_cast<U>(lhs.value_) - rhs; };
» more...
Subtracts a constrained value from a safe_int
template<
typename U,
typename CP>
requires detail::integral<U>
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator-(
safe_int lhs,
constrained<U, CP> rhs);
» more...
Subtracts a non-integral constrained value from a safe_int
template<
typename U,
typename CP>
requires (!std::integral<U>)
[[nodiscard]]
constexpr
constrained<decltype(std::declval<T>() - std::declval<U>()), CP>
operator-(
safe_int lhs,
constrained<U, CP> const& rhs);
» more...
Subtracts a safe_int from a constrained value
template<
typename U,
typename CP>
requires detail::integral<U>
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator-(
constrained<U, CP> lhs,
safe_int rhs);
» more...
Subtracts a safe_int from a non-integral constrained value
template<
typename U,
typename CP>
requires (!std::integral<U>)
[[nodiscard]]
constexpr
constrained<decltype(std::declval<U>() - std::declval<T>()), CP>
operator-(
constrained<U, CP> const& lhs,
safe_int rhs);
» more...
xlhs - rhs; triggers ErrorPolicy::on_overflow on overflowsafe_int of the promoted result type; triggers ErrorPolicy::on_overflow on overflowlhs and the wrapped valuerhsThe return value should not be discarded.
| Name | Description |
|---|---|
| U | the integral scalar type |
| Name | Description |
|---|---|
| x | the wrapped value to negate |
| lhs | the value to subtract from |
| rhs | the value to subtract |