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:
- A
std::ratio defining the conversion factor to the base unit type. (e.g. std::ratio<1,12> for inches to feet)
- A base unit that the unit is derived from (or a unit category. Must be of type
unit or base_unit)
- An exponent representing factors of PI required by the conversion. (e.g.
std::ratio<-1> for a radians to degrees conversion)
- a ratio representing a datum translation required for the conversion (e.g.
std::ratio<32> for a fahrenheit to celsius conversion)
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
-
| Conversion | std::ratio representing scalar multiplication factor. |
| BaseUnit | Unit type which this unit is derived from. May be a base_unit, or another unit. |
| PiExponent | std::ratio representing the exponent of pi required by the conversion. |
| Translation | std::ratio representing any datum translation required by the conversion. |