quantities.base

This module defines the base types for unit and quantity handling.

Members

Aliases

Dimensions
alias Dimensions = int[string]

The type of a set of dimensions.

Functions

binop
Dimensions binop(Dimensions dim1, Dimensions dim2)
Undocumented in source. Be warned that the author may not have intended to support it.
binop
Dimensions binop(Dimensions dim1, Dimensions dim2)
Undocumented in source. Be warned that the author may not have intended to support it.
dimdup
Dimensions dimdup(Dimensions dim)
Undocumented in source. Be warned that the author may not have intended to support it.
equals
bool equals(Dimensions dim1, Dimensions dim2)
Undocumented in source. Be warned that the author may not have intended to support it.
invert
Dimensions invert(Dimensions dim)
Undocumented in source. Be warned that the author may not have intended to support it.
pow
Dimensions pow(Dimensions dim, int power)
Undocumented in source. Be warned that the author may not have intended to support it.
powinverse
Dimensions powinverse(Dimensions dim, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
removeNull
Dimensions removeNull(Dimensions dim)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString(Dimensions dim)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

Quantity
struct Quantity(N, Dimensions dims)

A quantity that can be represented as the product of a number and a set of dimensions. The number is stored internally as a member of type N, which is enforced to be a built-in numeric type (isNumeric!N is true). The dimensions are stored as an associative array where keys are symbols and values are integral powers. For instance length and speed quantities can be stored as:

Templates

AreConsistent
template AreConsistent(Q1, Q2)

Check that two quantity types are dimensionally consistent.

isQuantity
template isQuantity(T)

Tests whether T is a quantity type

prefix
template prefix(alias factor)

Creates a new prefix function that mutlpy a Quantity by _factor factor.

unit
template unit(N, string symbol)

Creates a new monodimensional unit.

Meta

Authors

Nicolas Sicard