Skip to content

mp_units::natural_point_origin

The natural origin of the quantity QS, its zero

Synopsis

Declared in <mp-units/framework/quantity_point.h>

template<QuantitySpec auto QS>
constexpr /* implementation-defined */ natural_point_origin;

Description

Code rarely names it. A point created with point, or a quantity_point declared with no origin, is measured from it when its unit has no origin of its own, and delta_from_zero() reads how far such a point lies from zero. A point measured from an origin of the user's own, like mean_height below, has no delta_from_zero(), so code names the natural origin to ask the same question:

// the mean height of adults, an origin for a height distribution
inline constexpr struct mean_height final :
  relative_point_origin<point<isq::height[mm]>(1700.)> {} mean_height;

quantity_point tall = mean_height + 250. * mm;
quantity from_mean = tall.delta_from(mean_height);                        // 250 mm
quantity from_zero = tall.delta_from(natural_point_origin<isq::height>);  // 1950 mm

For a quantity defined with non_negative, it checks that no point lies below zero. A kind, as in point<m>, is never checked.

Template Parameters

NameDescription
QSthe quantity specification of the points measured from it

See Also