Modulus operators

Synopses

Declared in <mp‐units/utility/safe_int.h>

Computes the remainder of dividing an integral scalar by a safe_int.

Computes the remainder of dividing a safe_int by an integral scalar.

Computes the remainder of dividing lhs by rhs.

Computes the remainder of dividing a safe_int by a constrained value

Computes the remainder of dividing a constrained value by a safe_int

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 should not be discarded.

Template Parameters

Name

Description

U

the integral scalar type

Parameters

Name

Description

lhs

the integral scalar operand

rhs

the safe_int divisor

Created with MrDocs