BaseUnit

Shordhand for creating a basic unit with a name and a symbol, and no conversions defined.

When using BaseUnit, in virtually every use case, you also want to define an associated unit instance, as shown below. As there should be no real use for the unit type in user case anyway, you can also use baseUnit which directly returns a unit instance.

  1. struct BaseUnit(string name, string symbol = null)
    @safe
    struct BaseUnit (
    string name
    string symbol = null
    ) {}
  2. alias Foo = BaseUnit!("foo", "f")

Examples

alias BaseUnit!("Ampere", "A") Ampere;
enum ampere = Ampere.init;
// or
enum ampere = baseUnit!("Ampere", "A");

Meta