Quantity¶
Quantity
is our workhorse type for safely storing quantities of a given unit in some underlying
numeric variable.
TODO: this page is a stub
We will provide a full-fledged reference for quantities later. For now, here are the basics.
-
Quantity<U, R>
stores a value of numeric typeR
(called the “Rep”), whose units are the unit typeU
.- Example:
Quantity<Meters, double>
stores a length inMeters
, in adouble
variable.
- Example:
-
We provide “Rep-named aliases” for better ergonomics.
- Example:
QuantityD<Meters>
is an alias forQuantity<Meters, double>
.
- Example:
-
You cannot get values into or out of
Quantity
without explicitly naming the unit, at the callsite. For full details, see our tutorials, starting with the first: Au 101: Quantity Makers.
Handling temperatures
If you are working with temperatures — in the sense of “what temperature is it?”, rather than
“how much did the temperature change?” — you will want to use
QuantityPoint
instead of Quantity
.