Modulus operators
Synopses
Declared in <mp‐units/utility/safe_int.h>
Computes the remainder of dividing lhs by rhs.
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator%(
safe_int lhs,
safe_int rhs);
Computes the remainder of dividing an integral scalar by a safe_int.
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);
Computes the remainder of dividing a safe_int by an integral scalar.
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);
Computes the remainder of dividing a safe_int by a constrained value
template<
typename U,
typename CP>
requires detail::integral<U>
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator%(
safe_int lhs,
constrained<U, CP> rhs);
Computes the remainder of dividing a constrained value by a safe_int
template<
typename U,
typename CP>
requires detail::integral<U>
[[nodiscard]]
constexpr
safe_int</* implementation-defined */, ErrorPolicy>
operator%(
constrained<U, CP> lhs,
safe_int rhs);
Return Value
-
the remainder of
lhs / rhs; triggersErrorPolicy::on_overflowon modulo by zero -
the remainder, as a
safe_intof the promoted result type; triggersErrorPolicy::on_overflowon modulo by zero -
the wrapped remainder of the underlying values
|
Note
|
The return value should not be discarded. |
Template Parameters
Name |
Description |
U |
the integral scalar type |
Parameters
Name |
Description |
lhs |
the dividend |
rhs |
the divisor |
Created with MrDocs