A transparent wrapper that carries an error policy for domain constraint enforcement.
Synopsis
Declared in <mp‐units/utility/constrained.h>
template<
typename T,
ConstraintPolicy ErrorPolicy = throw_policy>
class constrained;
Description
This wrapper does not check anything itself. It serves as a signal to the mp‐units library that domain constraint violations should be reported via the ErrorPolicy rather than through precondition checks.
All arithmetic operations are forwarded to the underlying type T.
Type Aliases
Name |
Description |
The policy used to report domain constraint violations |
|
The underlying representation type |
Member Functions
Name |
Description |
|
Constructors |
Assigns the wrapped value to its remainder with respect to |
|
Multiplies the wrapped value by |
|
Increment operators |
|
Adds |
|
Decrement operators |
|
Subtracts |
|
Divides the wrapped value by |
|
The wrapped underlying value. |
|
Implicitly converts back to the underlying representation type. |
Data Members
Name |
Description |
The wrapped underlying value |
Friends
Name |
Description |
Negates the wrapped value |
|
Applies unary |
Non-Member Functions
Name |
Description |
Computes the remainder of dividing a constrained value by a safe_int |
|
Multiplies a constrained value by a safe_int |
|
Multiplies a safe_int by a non‐integral constrained value |
|
Multiplies a non‐integral constrained value by a safe_int |
|
Adds a constrained value to a safe_int |
|
Adds a safe_int to a non‐integral constrained value |
|
Adds a non‐integral constrained value to a safe_int |
|
Subtracts a safe_int from a non‐integral constrained value |
|
Subtracts a safe_int from a constrained value |
|
Subtracts a non‐integral constrained value from a safe_int |
|
Divides a non‐integral constrained value by a safe_int |
|
Divides a safe_int by a non‐integral constrained value |
|
Divides a constrained value by a safe_int |
Template Parameters
Name |
Description |
T |
the underlying representation type |
ErrorPolicy |
policy type satisfying ConstraintPolicy (provides static on_constraint_violation(std::string_view)) |
Created with MrDocs