Unary minus operators
Synopses
Declared in <mp‐units/utility/constrained.h>
Negates the wrapped value
[[nodiscard]]
constexpr
constrained<decltype(‐std::declval<T>()), ErrorPolicy>
operator‐(constrained const& x);
Subtracts a safe_int from an integral scalar, checking for overflow.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator‐(
U lhs,
safe_int rhs);
Subtracts a safe_int from a floating‐point value.
[[nodiscard]]
constexpr
auto
operator‐(
U lhs,
safe_int rhs)
requires requires { lhs ‐ static_cast<U>(rhs.value_); };
Subtracts an integral scalar from a safe_int, checking for overflow.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator‐(
safe_int lhs,
U rhs);
Subtracts a floating‐point value from a safe_int.
[[nodiscard]]
constexpr
auto
operator‐(
safe_int lhs,
U rhs)
requires requires { static_cast<U>(lhs.value_) ‐ rhs; };
Computes the difference of lhs and rhs.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator‐(
safe_int lhs,
safe_int rhs);
Subtracts a constrained value from a safe_int
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator‐(
safe_int lhs,
constrained<U, CP> rhs);
Subtracts a non‐integral constrained value from a safe_int
[[nodiscard]]
constexpr
constrained<decltype(std::declval<T>() ‐ std::declval<U>()), CP>
operator‐(
safe_int lhs,
constrained<U, CP> const& rhs);
Subtracts a safe_int from a constrained value
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator‐(
constrained<U, CP> lhs,
safe_int rhs);
Subtracts a safe_int from a non‐integral constrained value
[[nodiscard]]
constexpr
constrained<decltype(std::declval<U>() ‐ std::declval<T>()), CP>
operator‐(
constrained<U, CP> const& lhs,
safe_int rhs);
Return Value
-
the wrapped result of negating
x -
the difference, as a
safe_intof the promoted result type; triggersErrorPolicy::on_overflowon overflow -
the difference between
lhsand the wrapped value -
the difference between the wrapped value and
rhs -
the result of
lhs ‐ rhs; triggersErrorPolicy::on_overflowon overflow -
the wrapped difference of the underlying values
|
Note
|
The return value should not be discarded. |
Template Parameters
Name |
Description |
U |
the integral scalar type |
Parameters
Name |
Description |
x |
the wrapped value to negate |
lhs |
the integral scalar operand |
rhs |
the |
Created with MrDocs