mp_units::utility::measurement_of¶
Returns a measured constant as a quantity with an uncertain representation
Synopsis¶
Declared in <mp-units/utility/uncertain.h>
template<typename Rep = double, MeasuredConstant C>
[[nodiscard]] constexpr Quantity auto measurement_of(C);
Description¶
The uncertainty of a measured constant is relational: expressed in its own unit the constant is exactly 1, and the uncertainty belongs to the conversion factor between that unit and others. This function therefore returns 1 ± 0 of the constant in an uncertainty-capable representation, and the conversion engine materializes the relative standard uncertainty the moment the quantity leaves units in which the constant cancels (see fold_conversion_uncertainty). Seeding the value with u_r up front would double-count it on such a conversion, because the value's uncertainty and the factor's are the same, fully correlated one.
quantity G1 = measurement_of(iau::G); // uncertain<double>{1} * G, exactly 1 G
quantity G2 = G1.in(m3 / kg / s2); // 6.6743e-11 ± 1.46835e-15, u_r materialized
quantity G3 = measurement_of<float>(iau::G); // uncertain<float>
Return Value¶
a measured constant as a quantity with an uncertain representation
Note
The return value should not be discarded.
Template Parameters¶
| Name | Description |
|---|---|
| Rep | the underlying numeric type of the resulting uncertain representation |