[#mp_units-utility-operator_mod-0f] = xref:mp_units.adoc[mp_units]::xref:mp_units/utility.adoc[utility]::operator% :relfileprefix: ../../ :mrdocs: Modulus operators == Synopses Declared in `<mp‐units/utility/safe_int.h>` Computes the remainder of dividing an integral scalar by a `safe_int`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr xref:mp_units/utility/safe_int-07.adoc[safe_int</* implementation-defined */, ErrorPolicy>] xref:mp_units/utility/operator_mod-09.adoc[operator%]( U lhs, xref:mp_units/utility/safe_int-07.adoc[safe_int] rhs); ---- [.small]#xref:mp_units/utility/operator_mod-09.adoc[_» more..._]# Computes the remainder of dividing a `safe_int` by an integral scalar. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr xref:mp_units/utility/safe_int-07.adoc[safe_int</* implementation-defined */, ErrorPolicy>] xref:mp_units/utility/operator_mod-04.adoc[operator%]( xref:mp_units/utility/safe_int-07.adoc[safe_int] lhs, U rhs); ---- [.small]#xref:mp_units/utility/operator_mod-04.adoc[_» more..._]# Computes the remainder of dividing `lhs` by `rhs.` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr xref:mp_units/utility/safe_int-07.adoc[safe_int</* implementation-defined */, ErrorPolicy>] xref:mp_units/utility/operator_mod-0c.adoc[operator%]( xref:mp_units/utility/safe_int-07.adoc[safe_int] lhs, xref:mp_units/utility/safe_int-07.adoc[safe_int] rhs); ---- [.small]#xref:mp_units/utility/operator_mod-0c.adoc[_» more..._]# Computes the remainder of dividing a safe_int by a constrained value [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr xref:mp_units/utility/safe_int-07.adoc[safe_int</* implementation-defined */, ErrorPolicy>] xref:mp_units/utility/operator_mod-06.adoc[operator%]( xref:mp_units/utility/safe_int-07.adoc[safe_int] lhs, xref:mp_units/utility/constrained.adoc[constrained<U, CP>] rhs); ---- [.small]#xref:mp_units/utility/operator_mod-06.adoc[_» more..._]# Computes the remainder of dividing a constrained value by a safe_int [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard]] constexpr xref:mp_units/utility/safe_int-07.adoc[safe_int</* implementation-defined */, ErrorPolicy>] xref:mp_units/utility/operator_mod-0e.adoc[operator%]( xref:mp_units/utility/constrained.adoc[constrained<U, CP>] lhs, xref:mp_units/utility/safe_int-07.adoc[safe_int] rhs); ---- [.small]#xref:mp_units/utility/operator_mod-0e.adoc[_» more..._]# == Return Value * the remainder, as a `safe_int` of the promoted result type; triggers `ErrorPolicy::on_overflow` on modulo by zero * the remainder of `lhs / rhs`; triggers `ErrorPolicy::on_overflow` on modulo by zero * the wrapped remainder of the underlying values [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Template Parameters [cols="1,4"] |=== | Name| Description | *U* | the integral scalar type |=== == Parameters [cols="1,4"] |=== | Name| Description | *lhs* | the integral scalar operand | *rhs* | the `safe_int` divisor |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#