[#mp_units-utility-constrained]
= xref:mp_units.adoc[mp&lowbar;units]::xref:mp_units/utility.adoc[utility]::constrained
:relfileprefix: ../../
:mrdocs:

A transparent wrapper that carries an error policy for domain constraint enforcement&period;

== Synopsis

Declared in `&lt;mp&hyphen;units&sol;utility&sol;constrained&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename T,
    xref:mp_units/utility/ConstraintPolicy.adoc[ConstraintPolicy] ErrorPolicy = xref:mp_units/utility/throw_policy.adoc[throw&lowbar;policy]&gt;
class constrained;
----

== Description

This wrapper does not check anything itself&period; It serves as a signal to the mp&hyphen;units library that domain constraint violations should be reported via the ErrorPolicy rather than through precondition checks&period;

All arithmetic operations are forwarded to the underlying type T&period;

== Type Aliases

[cols="1"]
|===
| Name
| xref:mp_units/utility/constrained/error_policy.adoc[`error&lowbar;policy`] 
| xref:mp_units/utility/constrained/value_type.adoc[`value&lowbar;type`] 
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:mp_units/utility/constrained/2constructor-0742.adoc[`constrained`]         [.small]#[constructor]#
| Constructors
| xref:mp_units/utility/constrained/operator_mod_eq.adoc[`operator%&equals;`] 
| Modulus assignment operator
| xref:mp_units/utility/constrained/operator_star_eq.adoc[`operator&ast;&equals;`] 
| Multiplication assignment operator
| xref:mp_units/utility/constrained/operator_inc-0e.adoc[`operator&plus;&plus;`] 
| Increment operators
| xref:mp_units/utility/constrained/operator_plus_eq.adoc[`operator&plus;&equals;`] 
| Addition assignment operator
| xref:mp_units/utility/constrained/operator_dec-0d4.adoc[`operator&hyphen;&hyphen;`] 
| Decrement operators
| xref:mp_units/utility/constrained/operator_minus_eq.adoc[`operator&hyphen;&equals;`] 
| Subtraction assignment operator
| xref:mp_units/utility/constrained/operator_slash_eq.adoc[`operator&sol;&equals;`] 
| Division assignment operator
| xref:mp_units/utility/constrained/value.adoc[`value`] 
| 
| xref:mp_units/utility/constrained/2conversion.adoc[`operator T`] 
| Conversion to `T`
|===


== Data Members

[cols="1"]
|===
| Name
| xref:mp_units/utility/constrained/value_.adoc[`value&lowbar;`] 
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:mp_units/utility/operator_minus-0d1.adoc[mp&lowbar;units::utility::operator&hyphen;]`
| Unary minus operator
| `xref:mp_units/utility/operator_plus-0c.adoc[mp&lowbar;units::utility::operator&plus;]`
| Unary plus operator
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:mp_units/utility/operator_mod-0e.adoc[`operator%`]
| Modulus operator
| xref:mp_units/utility/operator_star-0b.adoc[`operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/operator_star-0e4.adoc[`operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/operator_star-0e8.adoc[`operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/operator_plus-02.adoc[`operator&plus;`]
| Addition operator
| xref:mp_units/utility/operator_plus-06b.adoc[`operator&plus;`]
| Addition operator
| xref:mp_units/utility/operator_plus-0fe8.adoc[`operator&plus;`]
| Addition operator
| xref:mp_units/utility/operator_minus-01.adoc[`operator&hyphen;`]
| Subtraction operator
| xref:mp_units/utility/operator_minus-05.adoc[`operator&hyphen;`]
| Subtraction operator
| xref:mp_units/utility/operator_minus-07.adoc[`operator&hyphen;`]
| Subtraction operator
| xref:mp_units/utility/operator_slash-04.adoc[`operator&sol;`]
| Division operator
| xref:mp_units/utility/operator_slash-082.adoc[`operator&sol;`]
| Division operator
| xref:mp_units/utility/operator_slash-08b.adoc[`operator&sol;`]
| Division operator
| xref:mp_units/utility/detail/operator_mod-08.adoc[`detail&colon;&colon;operator%`]
| Modulus operator
| xref:mp_units/utility/detail/operator_star-02.adoc[`detail&colon;&colon;operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/detail/operator_star-03.adoc[`detail&colon;&colon;operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/detail/operator_star-07.adoc[`detail&colon;&colon;operator&ast;`]
| Multiplication operator
| xref:mp_units/utility/detail/operator_plus-06.adoc[`detail&colon;&colon;operator&plus;`]
| Addition operator
| xref:mp_units/utility/detail/operator_minus-09.adoc[`detail&colon;&colon;operator&hyphen;`]
| Subtraction operator
| xref:mp_units/utility/detail/operator_slash-0c.adoc[`detail&colon;&colon;operator&sol;`]
| Division operator
| xref:mp_units/utility/detail/operator_slash-0fb.adoc[`detail&colon;&colon;operator&sol;`]
| Division operator
| xref:mp_units/utility/detail/operator_slash-0ff.adoc[`detail&colon;&colon;operator&sol;`]
| Division operator
| xref:mp_units/utility/detail/operator_3way-04.adoc[`detail&colon;&colon;operator&lt;&equals;&gt;`]
| Three&hyphen;way comparison operator
| xref:mp_units/utility/detail/operator_eq-0e.adoc[`detail&colon;&colon;operator&equals;&equals;`]
| Equality operator
|===

== Template Parameters

[cols="1,4"]
|===
| Name| Description
| *T*
| the underlying representation type
| *ErrorPolicy*
| policy type satisfying ConstraintPolicy (provides static on&lowbar;constraint&lowbar;violation(std&colon;&colon;string&lowbar;view))
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
