Customization point for providing bounds on a quantity point relative to an origin.
<mp-units/framework/customization_points.h>template<PointOrigin auto PO>
requires (PO._quantity_spec_.character == quantity_character::real_scalar)
inline constexpr auto quantity_bounds = detail::undefined;
Users specialize this variable template for point origins (both absolute and relative). The value should be an overflow-policy object that stores the bounds (e.g. reflect_in_range, clamp_to_range, wrap_to_range).
Bounds are always enforced as constraints on quantity_from(Origin) — the displacement measured in the frame of the specialized origin. Different origins (including relative ones) may have independent bounds; it is the user's responsibility to keep them consistent when multiple levels of bounds are in use.
Example:
{.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)};
| Name | Description |
|---|---|
| PO | a point origin for which bounds are defined |