// The following three lines define the same unit. Most of the time, the // third syntax is the preferred one because it directly declares a unit // instance. alias ScaledUnit!(Metre, 0.0254, "inch", "in") Inch; alias ScaledUnit!(metre, 0.0254, "inch", "in") Inch; enum inch = scale!(metre, 0.0254, "inch", "in");
Shorthands for defining base units with a single conversion factor to another base unit.
The conversion is done by simply multiplying/dividing the value by the passed factor, which thus has to be defined for all value types this scaled unit is used with.
Note that a generic alias is accepted as scaling factor, which makes it possible to use runtime values as scale factors without writing a custom unit type.