prefixTemplate

Shorthand for defining prefix templates like kilo!().

The created template, accessible via the result property, takes a unit instance and applies a prefix from the given list of prefixes to it.

@safe
template prefixTemplate (
int exponent
alias System
) {}

Examples

1 alias PrefixSystem!(10, { return [
2    Prefix(-3, "milli", "m"),
3    Prefix(3, "kilo", "k")
4 ]; }) System;
5 alias prefixTemplate!(-3, System) milli;
6 alias prefixTemplate!(3, System) kilo;
7 // Use the templates like this: milli!metre, kilo!metre, etc.

Meta