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::absolute< U > Class Template Reference

A point on a (possibly affine) scale — carries the unit's 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 absolute () noexcept=default
 < the wrapped unit's numeric type
constexpr absolute (const U &point) noexcept
constexpr absolute (underlying_type value) noexcept
 Construct a point directly from its underlying numeric value (in U's own unit).
constexpr auto value () const noexcept
 The point's numeric value in its own unit.
constexpr auto raw () const noexcept
 The point's raw (linearized) value.
constexpr auto to_linearized () const noexcept
 The point's linearized value (as the wrapped unit's to_linearized()).
constexpr const char * name () const noexcept
 The wrapped unit's name/abbreviation (a point does not rename the unit).
constexpr const char * abbreviation () const noexcept
template<ArithmeticType Arithmetic>
constexpr Arithmetic to () const noexcept
 Express this point's value as a plain arithmetic type — the numeric value in its own unit (absolute<celsius<double>>(20).to<int>() is 20), 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 point as a PLAIN unit of the same dimension — unwraps, applying the datum offset (absolute<celsius>(0).to<kelvin<double>>() is 273.15 K; .to<celsius<double>>() is the plain wrapped point).
template<AbsoluteType WrapperTarget>
requires traits::is_same_dimension_unit_v<U, typename WrapperTarget::unit_type>
constexpr WrapperTarget to () const noexcept
 Express this point as another absolute<V> — stays a point (the datum is applied as it re-wraps).

Detailed Description

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

A point on a (possibly affine) scale — carries the unit's datum.

Template Parameters
Uthe wrapped unit type.

Member Function Documentation

◆ to() [1/2]

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

Express this point as another absolute<V> — stays a point (the datum is applied as it re-wraps).

Only an absolute target is a viable wrapper here; a delta<V>/kind<...> target has no matching overload (a point cannot become an amount 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::absolute< U >::to ( ) const
inlineconstexprnoexcept

Express this point as a PLAIN unit of the same dimension — unwraps, applying the datum offset (absolute<celsius>(0).to<kelvin<double>>() is 273.15 K; .to<celsius<double>>() is the plain wrapped point).

A plain-unit target is NOT a wrapper, so this overload owns the unwrap path.


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