Reference Docs¶
This section contains detailed reference documentation on Quantity
, QuantityPoint
, units,
dimensions, magnitudes, and other core library abstractions. The main folder is reserved for things
that end users will routinely interact with. Implementation details will be documented in
a detail
sub-folder.
Here’s a guide to the main reference pages.
-
Quantity
. This is the main type you’ll use to replace raw numeric types. It acts like a numeric type, but it keeps track of its units.QuantityPoint
. Similar toQuantity
, but for modeling affine space types. This means you can subtract twoQuantityPoint
s, and you’ll get aQuantity
(just like subtracting two points gives a displacement). Practically speaking, this is essential for dealing with temperatures, and useful for a couple other dimensions such as pressures and distances.
-
Constant
. A constant quantity which is known at compile time, and represented by a symbol. Supports exact symbolic arithmetic at compile time, and a perfect conversion policy toQuantity
types. -
Unit
. A type which represents a unit of measure. -
Magnitude
. A special kind of compile-time number, which we use to represent ratios between pairs of units. Can handle many challenging use cases whichstd::ratio
can’t, and which are necessary for units libraries — such as irrational numbers, or extremely large or small numbers. -
Prefix
. A term that can be applied to the beginning of a unit, to make a new unit with a specified relative size. For example,centi
is a prefix whose relative magnitude is 1/100, and acenti(meter)
is a new unit which is one one-hundredth of ameter
. -
Math functions
. We provide many common mathematical functions out of the box.
See the sidebar for the complete list of pages.