Unit Conversion and Dimensional Analysis Library  2.3.0
A compile-time c++14 unit conversion library
Classes | Functions
Unit Containers

Defines a series of classes which contain dimensioned values. Unit containers store a value, and support various arithmetic operations. More...

Classes

class  units::unit_t< Units, T, NonLinearScale >
 Container for values which represent quantities of a given unit. More...
 
struct  units::unit_value_t< Units, Num, Denom >
 Stores a rational unit value as a compile-time constant. More...
 

Functions

template<class UnitType , typename T , class = std::enable_if_t<std::is_arithmetic<T>::value>>
constexpr UnitType units::make_unit (const T value) noexcept
 Constructs a unit container from an arithmetic type. More...
 

Detailed Description

Defines a series of classes which contain dimensioned values. Unit containers store a value, and support various arithmetic operations.

Function Documentation

◆ make_unit()

template<class UnitType , typename T , class = std::enable_if_t<std::is_arithmetic<T>::value>>
constexpr UnitType units::make_unit ( const T  value)
inlineconstexprnoexcept

Constructs a unit container from an arithmetic type.

make_unit can be used to construct a unit container from an arithmetic type, as an alternative to using the explicit constructor. Unlike the explicit constructor it forces the user to explicitly specify the units.

Template Parameters
UnitTypeType to construct.
TyArithmetic type.
Parameters
[in]valueArithmetic value that represents a quantity in units of UnitType.