[#mp_units-constraint_violation_handler-0c]
= xref:mp_units.adoc[mp&lowbar;units]::constraint&lowbar;violation&lowbar;handler
:relfileprefix: ../
:mrdocs:

Customization point for handling domain constraint violations&period;

== Synopsis

Declared in `&lt;mp&hyphen;units&sol;framework&sol;customization&lowbar;points&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Rep&gt;
struct constraint&lowbar;violation&lowbar;handler;
----

== Description

The library calls `constraint&lowbar;violation&lowbar;handler&lt;Rep&gt;&colon;&colon;on&lowbar;violation(msg)` when a domain constraint is violated (e&period;g&period;, out&hyphen;of&hyphen;bounds value, non&hyphen;negativity)&period;

No default implementation is provided&period; When no specialization exists for a given Rep, the library uses MP&lowbar;UNITS&lowbar;EXPECTS directly (which may compile to nothing in release builds)&period; Specializing this trait opts the type into guaranteed enforcement&period;

== Template Parameters

[cols="1,4"]
|===
|Name|Description

| *Rep*
| the representation type
|===


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