Skip to content

mp_units::delta

Creates a delta of reference R from a number

Synopsis

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

template<Reference auto R>
constexpr /* implementation-defined */ delta = {};

Description

delta<R>(v) returns a quantity of reference R that holds v, with the representation type deduced from v. It gives the same result as v * R, which is deprecated for a unit with a point origin, such as si::kelvin or si::degree_Celsius. 42 * deg_C could mean a temperature or a temperature difference, and delta and point state which one is meant.

// a thermostat switches the heating off half a degree above its setpoint
quantity_point setpoint = point<deg_C>(21.);
quantity hysteresis = delta<deg_C>(0.5);
quantity_point switch_off = setpoint + hysteresis;  // 21.5 °C

Template Parameters

NameDescription
Rthe reference or unit of the delta

See Also

  • point for creating a point from a number
  • The Affine Space for when a value is a delta and when it is a point