PrefixSystem

A prefix system, used with PrefixedUnit.

Use the DefinePrefixSystem mixin to automatically generate a helper function like kilo() for every prefix in the system.

getPrefixes has to be a parameterless callable returning Prefix[]. This scheme is used (instead of directly passing the prefix array as a parameter) to reduce code bloat, because delegate literals are mangled much shorter than array literals. The effect on the binary size is quite strong because the mangled name of a PrefixSystem instance is part of every symbol in which a PrefixedUnit is involved.

@safe
template PrefixSystem (
long systemBase
alias getPrefixes
) if (
is(typeof(getPrefixes()) : Prefix[])
) {}

Members

Manifest constants

base
enum base;
Undocumented in source.
prefixes
enum prefixes;
Undocumented in source.

Examples

alias PrefixSystem!(10, { return [
    Prefix(-3, "milli", "m"),
    Prefix(3, "kilo", "k")
]; }) System;

Meta