[#mp_units-quantity_bounds]
= xref:mp_units.adoc[mp&lowbar;units]::quantity&lowbar;bounds
:relfileprefix: ../
:mrdocs:

Customization point for providing bounds on a quantity point relative to an origin&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;xref:mp_units/PointOrigin.adoc[PointOrigin] auto PO&gt;
requires (PO&period;&lowbar;quantity&lowbar;spec&lowbar;&period;character &equals;&equals; quantity&lowbar;character&colon;&colon;real&lowbar;scalar)
inline constexpr auto quantity&lowbar;bounds = detail&colon;&colon;undefined;
----

== Description

Users specialize this variable template for point origins (both absolute and relative)&period; The value should be an overflow&hyphen;policy object that stores the bounds (e&period;g&period; `reflect&lowbar;in&lowbar;range`, `clamp&lowbar;to&lowbar;range`, `wrap&lowbar;to&lowbar;range`)&period;

Bounds are always enforced as constraints on `quantity&lowbar;from(Origin)` — the displacement measured in the frame of the specialized origin&period; Different origins (including relative ones) may have independent bounds&semi; it is the user&apos;s responsibility to keep them consistent when multiple levels of bounds are in use&period;

Example&colon;

[,cpp]
----
{.cpp}
 // Absolute origin: latitude reflects at poles
 inline constexpr struct equator final : absolute_point_origin<geo_latitude> {} equator;
 template<>
 constexpr auto quantity_bounds<equator> = reflect_in_range{-90 * deg, 90 * deg};

 // Relative origin: AC controller setpoint — comfort range clamped around 21 °C
 inline constexpr struct room_reference_temp final :
     relative_point_origin<point<deg_C>(21)> {} room_reference_temp;
 template<>
 constexpr auto quantity_bounds<room_reference_temp> = clamp_to_range{delta<deg_C>(-3), delta<deg_C>(3)};
----
== Template Parameters

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

| *PO*
| a point origin for which bounds are defined
|===


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