mp_units::scale

scale overloads

Synopses

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

Scale value by the unit magnitude passed as m, converting to type To.

template<
    typename To,
    UnitMagnitude M,
    typename From>
requires detail::UnitMagnitudeScalable<From>
[[nodiscard]]
constexpr
auto
scale(
    M m,
    From const& value);
» more...

Scale value by the unit magnitude passed as m, converting to type To, with the result rounded according to policy.

template<
    typename To,
    UnitMagnitude M,
    typename From,
    RoundingPolicy Policy>
requires detail::UnitMagnitudeScalable<From>
[[nodiscard]]
constexpr
auto
scale(
    M m,
    From const& value,
    Policy policy);
» more...

Return Value

  • value scaled by m, truncated to type To
  • value scaled by m, rounded to type To according to policy

NOTE

The return value should not be discarded.

Parameters

NameDescription
munit magnitude to scale value by
valuevalue being scaled
policyrounding policy tag selecting how the scaled result is rounded