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 auto xo::qty::qty::picogram = picograms(1)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static auto xo::qty::qty::megatonne = megatonnes(1)

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

static auto xo::qty::qty::gigatonne = gigatonnes(1)

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

Distance

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static auto xo::qty::qty::inch = inches(1)

a quantity representing 1 inch of distance, with compile-time unit operations

static auto xo::qty::qty::foot = feet(1)

a quantity representing 1 foot of distance, with compile-time unit operations

static auto xo::qty::qty::yard = yards(1)

a quantity representing 1 yard of distance, with compile-time unit operations

static auto xo::qty::qty::mile = miles(1)

a quantity representing 1 mile of distance, with compile-time unit operations

Time

static auto xo::qty::qty::picosecond = picoseconds(1L)

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

static auto xo::qty::qty::nanosecond = nanoseconds(1L)

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

static auto xo::qty::qty::microsecond = microseconds(1L)

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

static auto xo::qty::qty::millisecond = milliseconds(1L)

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

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

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

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

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

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

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

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

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

static auto xo::qty::qty::week = weeks(1L)

a quantity representing 1 week of time (7 24-hour days), with compile-time unit representation

static auto xo::qty::qty::month = months(1L)

a quantity representing 1 month of time (30 24-hour days), with compile-time unit representation

static auto xo::qty::qty::year = years(1L)

a quantity representing 1 year of time (365.25 24-hour days), with compile-time unit representation

static auto xo::qty::qty::year250 = year250s(1L)

a quantity representing 1 250-day year of time, with compile-time unit representation

static auto xo::qty::qty::year360 = year360s(1L)

a quantity representing 1 360-day year of time, with compile-time unit representation

static auto xo::qty::qty::year365 = year365s(1L)

a quantity representing 1 365-day year of time, with compile-time unit representation