Unary plus operators
Declared in <mp-units/utility/constrained.h>
Applies unary + to the wrapped value
[[nodiscard]]
constexpr
constrained<decltype(+std::declval<T>()), ErrorPolicy>
operator+(constrained const& x);
» more...
Adds a safe_int to an integral scalar, checking for overflow.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator+(
U lhs,
safe_int rhs);
» more...
Adds a safe_int to a floating-point value.
[[nodiscard]]
constexpr
auto
operator+(
U lhs,
safe_int rhs)
requires requires { lhs + static_cast<U>(rhs.value_); };
» more...
Adds an integral scalar to a safe_int, checking for overflow.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator+(
safe_int lhs,
U rhs);
» more...
Adds a floating-point value to a safe_int.
[[nodiscard]]
constexpr
auto
operator+(
safe_int lhs,
U rhs)
requires requires { static_cast<U>(lhs.value_) + rhs; };
» more...
Computes the sum of lhs and rhs.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator+(
safe_int lhs,
safe_int rhs);
» more...
Adds a safe_int to a constrained value
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator+(
safe_int lhs,
constrained<U, CP> rhs);
» more...
Adds a non-integral constrained value to a safe_int
[[nodiscard]]
constexpr
constrained<decltype(std::declval<T>() + std::declval<U>()), CP>
operator+(
safe_int lhs,
constrained<U, CP> const& rhs);
» more...
Adds a constrained value to a safe_int
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator+(
constrained<U, CP> lhs,
safe_int rhs);
» more...
Adds a safe_int to 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);
» more...
+ to xsafe_int of the promoted result type; triggers ErrorPolicy::on_overflow on overflowlhs and the wrapped valuerhslhs and rhs; triggers ErrorPolicy::on_overflow on overflowThe return value should not be discarded.
| Name | Description |
|---|---|
| U | the integral scalar type |
| Name | Description |
|---|---|
| x | the wrapped value to apply unary + to |
| lhs | the integral scalar operand |
| rhs | the safe_int to add |