mp_units::quantity::numerical_value_in

Returns the numerical value converted to another unit, applying an explicit rounding policy.

Synopsis

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

template<
    UnitOf<quantity_spec> U,
    RoundingPolicy Policy>
requires detail::ExplicitlyCastable<unit, U{}, rep> && detail::ValidRoundingPolicyFor<Policy, rep, rep>
[[nodiscard]]
constexpr
RepresentationOf<quantity_spec> auto
numerical_value_in(
    U u,
    Policy policy) const noexcept;

Return Value

The numerical value expressed in u.

NOTE

The return value should not be discarded.

Parameters

NameDescription
uthe target unit
policythe rounding policy to apply when the conversion is not exact