Quantity Unit Variables

Built-in unit quantities

Context

_images/ditaa-8403fa66acef33ca91cef45ab20b9810035d93a5.png

Introduction

#include <xo/unit/quantity.hpp>

The xo::qty::qty namespace contains unit quantities in each dimension. Can use these to assemble unit quantities with compound dimensions

1#include "xo/unit/quantity.hpp"
2
3namespace q = xo::qty::qty;
4
5auto q1 = (q::kilometers(150.0) / q::hours(0.5));
6constexpr auto u_mps = q:meter / q:second;
7auto q2 = with_units_from(q1, u_mps);

Mass

static constexpr auto xo::qty::qty::picogram = picograms(1)

a quantity representing 1 picogram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::nanogram = nanograms(1)

a quantity representing 1 nanogram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::microgram = micrograms(1)

a quantity representing 1 microgram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::milligram = milligrams(1)

a quantity representing 1 milligram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::gram = grams(1)

a quantity representing 1 gram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::kilogram = kilograms(1)

a quantity representing 1 kilogram of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::tonne = tonnes(1)

a quantity representing 1 metric tonne of mass, with compile-time unit representation

static constexpr auto xo::qty::qty::kilotonne = kilotonnes(1)

a quantity representing 1 metric kilotonne of mass, with compile-time unit representation

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::megatonne” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::gigatonne” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Distance

static constexpr auto xo::qty::qty::picometer = picometers(1)

a quantity representing 1 picometer of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::nanometer = nanometers(1)

a quantity representing 1 nanometer of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::micrometer = micrometers(1)

a quantity representing 1 micrometer of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::millimeter = millimeters(1)

a quantity representing 1 millimeter of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::meter = meters(1)

a quantity representing 1 meter of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::kilometer = kilometers(1)

a quantity representing 1 kilometer of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::megameter = megameters(1)

a quantity representing 1 megameter of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::gigameter = gigameters(1)

a quantity representing 1 gigameter of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::lightsecond = lightseconds(1)

a quantity representing exactly 1 lightsecond of distance, with compile-time unit representation

static constexpr auto xo::qty::qty::astronomicalunit = astronomicalunits(1)

a quantity representing exactly 1 astronomical unit of distance, with compile-time unit representation

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::inch” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::foot” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::yard” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::mile” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Time

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::picosecond” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::nanosecond” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::microsecond” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::millisecond” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

static constexpr auto xo::qty::qty::second = seconds(1)

a quantity representing 1 second of time, with compile-time unit representation

static constexpr auto xo::qty::qty::minute = minutes(1)

a quantity representing 1 minute of time, with compile-time unit representation

static constexpr auto xo::qty::qty::hour = hours(1)

a quantity representing 1 hour of time, with compile-time unit representation

static constexpr auto xo::qty::qty::day = days(1)

a quantity representing 1 day of time (exactly 24 hours), with compile-time unit representation

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::week” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::month” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::year” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::year250” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::year360” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml

Warning

doxygenvariable: Cannot find variable “xo::qty::qty::year365” in doxygen xml output for project “xodoxxml” from directory: /home/roland/proj/xo/xo-unit/.build-ccov/docs/dox/xml