mp_units::scaling_traits

A type trait that defines the behavior of scaling a value using a magnitude

Synopsis

Declared in <mp-units/framework/scaling.h>
template<
    typename From,
    typename To>
struct scaling_traits
    : /* implementation-defined */

Description

Whereas C++ numeric types usually represent a (fixed) subset of the real numbers (or another vector-space over the field of the real numbers), the magnitude concept fundamentally can represent any real number. Thus, in general, the result of a scaling operation is not exactly representable, and some form of approximation may be needed. That approximation is not part of the semantics of a physical quantity, but of its representation in C++. Therefore, the approximation semantics are dictated by the representation type, which can be customised for user-types through this type-trait.

In the following, shall denote the vector-space represented by all representation types involved in the following discussion.

A specialization scaling_traits<From, To> shall provide the following member:

Base Classes

Name Description
/* implementation-defined */

Template Parameters

Name Description
From a representation type whose value is being scaled
To a representation type in which the result shall be represented