mp_units::is_integral_scaling

Returns true if the scaling factor from from to to is an exact positive integer.

Synopsis

Declared in <mp-units/framework/value_cast.h>
[[nodiscard]]
consteval
bool
is_integral_scaling(
    auto from,
    auto to);

Description

This is the key predicate used by the default implicitly_scalable to decide whether conversions between integer-like representation types are non-truncating (and therefore may be implicit). For example, m → mm has an integral factor (×1000), so integer conversions in that direction are implicit; mm → m has a fractional factor (÷1000), so they are explicit.

Parameters

Name Description
from source unit
to target unit