compileTimeParser

Creates a compile-time parser that parses a string for a quantity and automatically deduces the quantity type.

template compileTimeParser (
N
alias symbolList
alias numberParser
) {}

Members

Templates

compileTimeParser
template compileTimeParser(string str)
Undocumented in source.

Examples

enum century = unit!(real, "century");
alias LectureLength = typeof(century);

enum symbolList = SymbolList!real()
    .addUnit("Cy", century)
    .addPrefix("µ", 1e-6L);

alias ctParser = compileTimeParser!(real, symbolList, std.conv.parse!(real, string));
enum timing = 1e-6L * century;
static assert(timing == ctParser!"1 µCy");

Meta