mp_units::quantity::in

Returns this quantity re-expressed in another unit, applying an explicit rounding policy.

Synopsis

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

template<
    UnitOf<quantity_spec> ToU,
    RoundingPolicy Policy>
requires detail::ExplicitlyCastable<unit, ToU{}, rep> && detail::ValidRoundingPolicyFor<Policy, rep, rep>
[[nodiscard]]
constexpr
QuantityOf<quantity_spec> auto
in(
    ToU to_u,
    Policy policy) const;

Return Value

The equivalent quantity expressed in to_u.

NOTE

The return value should not be discarded.

Parameters

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