Quantity.opUnary

Unary plus/minus operators.

  1. auto opUnary()
    struct Quantity(Unit, ValueType = double)
    static if(!is(Unit.LinearBaseUnit BaseUnit))
    opUnary
    (
    string op
    )
    ()
    if (
    (
    op == "+" ||
    op == "-"
    )
    &&
    is(typeof(mixin (op ~ "ValueType.init")))
    )
    if (
    isUnit!Unit
    )
  2. auto opUnary()

Examples

auto l = 6 * metre;
assert(+l == 6 * metre);
assert(-l == (-6) * metre);

Meta