quantities

The purpose of this small library is to perform automatic compile-time or run-time dimensional checking when dealing with quantities and units.

There is no actual distinction between units and quantities, so there are no distinct quantity and unit types. All operations are actually done on quantities. For example, meter is both the unit _meter_ and the quantity _1m_. New quantities can be derived from other ones using operators or dedicated functions.

Quantities can be parsed from strings at run time and compile time.

The main SI units and prefixes are predefined. Units with other dimensions can be defined by the user.

Modules

common
module quantities.common
Undocumented in source.
compiletime
module quantities.compiletime

This module defines quantities that are statically checked for dimensional consistency at compile-time.

parsing
module quantities.parsing

This module defines functions to parse units and quantities.

runtime
module quantities.runtime

This module defines dimensionally variant quantities, mainly for use at run-time.

si
module quantities.si

Importing quantities.si instantiate all the definitions of the SI units, prefixes, parsing functions and formatting functions, both at run-time and compile-time, storint their values as a double.

Public Imports

quantities.compiletime
public import quantities.compiletime;
quantities.runtime
public import quantities.runtime;
quantities.common
public import quantities.common;
quantities.parsing
public import quantities.parsing;
quantities.si
public import quantities.si;

Meta

License

Boost License 1.0.