Unit Conversion and Dimensional Analysis Library 3.6.1
A compile-time, header-only C++23 dimensional-analysis library
Loading...
Searching...
No Matches
units::affine::delta< U > Class Template Reference

An amount of a quantity — offset-free (no datum). More...

#include <kind.h>

Public Types

using unit_type = U
using underlying_type = typename traits::unit_traits<U>::underlying_type
 < the wrapped unit type

Public Member Functions

constexpr delta () noexcept=default
 < the wrapped unit's numeric type
constexpr delta (const U &amount) noexcept
constexpr delta (underlying_type value) noexcept
 Construct an amount directly from its underlying numeric value (in U's own unit).
constexpr auto value () const noexcept
 The amount's numeric value in its own unit.
constexpr auto raw () const noexcept
 The amount's raw (linearized) value.
constexpr auto to_linearized () const noexcept
 The amount's linearized value (as the wrapped unit's to_linearized()).
constexpr const char * name () const noexcept
 The wrapped unit's name/abbreviation (an amount does not rename the unit).
constexpr const char * abbreviation () const noexcept
template<ArithmeticType Arithmetic>
constexpr Arithmetic to () const noexcept
 Express this amount's value as a plain arithmetic type — the numeric value in its own unit, matching the wrapped unit's to<Arithmetic>().
template<UnitType PlainTarget>
requires traits::is_same_dimension_unit_v<U, PlainTarget>
constexpr PlainTarget to () const noexcept
 Express this amount as a PLAIN unit of the same dimension — unwraps, SCALE ONLY (the datum is never applied): a 10 degC delta is an 18 degF delta, never an absolute 50 degF.
template<DeltaType WrapperTarget>
requires traits::is_same_dimension_unit_v<U, typename WrapperTarget::unit_type>
constexpr WrapperTarget to () const noexcept
 Express this amount as another delta<V> — stays an amount (scale-only).

Detailed Description

template<UnitType U>
class units::affine::delta< U >

An amount of a quantity — offset-free (no datum).

Template Parameters
Uthe wrapped unit type (its datum is ignored; only its scale matters).

Member Function Documentation

◆ to() [1/2]

template<UnitType U>
template<DeltaType WrapperTarget>
requires traits::is_same_dimension_unit_v<U, typename WrapperTarget::unit_type>
WrapperTarget units::affine::delta< U >::to ( ) const
inlineconstexprnoexcept

Express this amount as another delta<V> — stays an amount (scale-only).

Only a delta target is a viable wrapper here; an absolute<V>/kind<...> target has no matching overload (an amount cannot become a point or a tagged kind through to).

◆ to() [2/2]

template<UnitType U>
template<UnitType PlainTarget>
requires traits::is_same_dimension_unit_v<U, PlainTarget>
PlainTarget units::affine::delta< U >::to ( ) const
inlineconstexprnoexcept

Express this amount as a PLAIN unit of the same dimension — unwraps, SCALE ONLY (the datum is never applied): a 10 degC delta is an 18 degF delta, never an absolute 50 degF.

.to<celsius<double>>() is the plain wrapped amount. A conversion into a coarser integer unit (that would truncate) is rejected with a clear message rather than template-substitution spew; convert to a floating-point delta first if the truncation is intended.


The documentation for this class was generated from the following file:
  • /home/runner/work/units/units/include/units/kind.h