Unit Conversion and Dimensional Analysis Library  2.3.0
A compile-time c++14 unit conversion library
Public Types | List of all members
units::unit< Conversion, BaseUnit, PiExponent, Translation > Struct Template Reference

Type representing an arbitrary unit. More...

#include <units.h>

Inheritance diagram for units::unit< Conversion, BaseUnit, PiExponent, Translation >:

Public Types

typedef units::traits::unit_traits< BaseUnit >::base_unit_type base_unit_type
 
typedef std::ratio_multiply< typename BaseUnit::conversion_ratio, Conversion > conversion_ratio
 
typedef std::ratio_add< typename BaseUnit::pi_exponent_ratio, PiExponent > pi_exponent_ratio
 
typedef std::ratio_add< std::ratio_multiply< typename BaseUnit::conversion_ratio, Translation >, typename BaseUnit::translation_ratio > translation_ratio
 

Detailed Description

template<class Conversion, class BaseUnit, class PiExponent = std::ratio<0>, class Translation = std::ratio<0>>
struct units::unit< Conversion, BaseUnit, PiExponent, Translation >

Type representing an arbitrary unit.

unit types are used as tags for the conversion function. They are not containers (see unit_t for a container class). Each unit is defined by:

Typically, a specific unit, like meters, would be implemented as a type alias of unit, i.e. using meters = unit<std::ratio<1>, units::category::length_unit, or using inches = unit<std::ratio<1,12>, feet>.

Template Parameters
Conversionstd::ratio representing scalar multiplication factor.
BaseUnitUnit type which this unit is derived from. May be a base_unit, or another unit.
PiExponentstd::ratio representing the exponent of pi required by the conversion.
Translationstd::ratio representing any datum translation required by the conversion.

The documentation for this struct was generated from the following file: