mp_units::constrained

A transparent wrapper that carries an error policy for domain constraint enforcement.

Synopsis

Declared in <mp-units/constrained.h>
template<
    typename T,
    typename 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.

Types

Name
error_policy
value_type

Member Functions

NameDescription
constrained [constructor]Constructors
operator%= Modulus assignment operator
operator*= Multiplication assignment operator
operator++ Increment operators
operator+= Addition assignment operator
operator-- Decrement operators
operator-= Subtraction assignment operator
operator/= Division assignment operator
value
operator T Conversion to T

Data Members

Name
value_

Friends

|===
Name Description
operator- Unary minus operator
operator+ Unary plus operator

Template Parameters

Name Description
T the underlying representation type
ErrorPolicy policy type providing static on_constraint_violation(const char*)