[#mp_units-check_in_range] = xref:mp_units.adoc[mp_units]::check_in_range :relfileprefix: ../ :mrdocs: Policy that checks the value is within [min, max]and reports violations. == Synopsis Declared in `<mp‐units/overflow_policies.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:mp_units/Quantity.adoc[Quantity] Q> struct check_in_range; ---- == Description If the quantity's representation type has a `constraint_violation_handler` specialization, the handler's `on_violation()` is called on out‐of‐bounds values (providing guaranteed enforcement regardless of build mode). Otherwise, falls back to `MP_UNITS_EXPECTS`, which may be disabled in release builds. Example: [,cpp] ---- {cpp} // With constrained rep → throws std::domain_error on violation // With plain double rep → asserts via MP_UNITS_EXPECTS (may be no-op in release) template<> constexpr auto quantity_bounds = check_in_range{-90 * deg, 90 * deg}; ---- == Member Functions [cols=1] |=== | Name | xref:mp_units/check_in_range/operator_call.adoc[`operator()`] |=== == Data Members [cols=1] |=== | Name | xref:mp_units/check_in_range/max.adoc[`max`] | xref:mp_units/check_in_range/min.adoc[`min`] |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#