PrefixedUnit

A unit with a scaling prefix applied, e.g. kilo(metre).

There is conceptually no difference between defining a regular conversion and prefixing a unit. However, PrefixedUnit automatically generates the name of the new unit, and it is able to fold multiple prefixes of the same system, e.g. milli(kilo(metre)) to just metre.

  1. struct PrefixedUnit(BaseUnit, int exponent, alias System)
    @safe
    struct PrefixedUnit (
    BaseUnit
    int exponent
    alias System
    ) if (
    isUnit!BaseUnit &&
    !(
    isPrefixedUnit!BaseUnit &&
    (BaseUnit.prefixBase == System.base)
    )
    ) {}
  2. template PrefixedUnit(BaseUnit, int exponent, alias System)
  3. template PrefixedUnit(alias baseUnit, int exponent, alias System)

Members

Aliases

Conversions
alias Conversions = AliasSeq!(Conversion!(BaseUnit, toBase, fromBase))
Undocumented in source.

Mixins

__anonymous
mixin UnitImpl
Undocumented in source.

Static functions

fromBase
V fromBase(V v)
Undocumented in source. Be warned that the author may not have intended to support it.
toBase
V toBase(V v)
Undocumented in source. Be warned that the author may not have intended to support it.
toString
string toString(UnitString type)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixed In Members

From mixin UnitImpl

opBinary
auto opBinary(Rhs rhs)

Multiplication/division of two unit instances, yielding a unit instance representing the product/quotient unit.

opBinary
auto opBinary(V rhs)
opBinaryRight
auto opBinaryRight(V lhs)

Multiplication/division of an unit and a value type, constructing a Quantity instance.

SuperSecretAliasToMarkThisAsUnit
alias SuperSecretAliasToMarkThisAsUnit = void
Undocumented in source.

Meta