Quantity.opBinary

Addition/substraction of a quantity with the linear base unit.

  1. auto opBinary(Quantity!(Unit, RhsV) rhs)
  2. auto opBinary(T rhs)
  3. auto opBinary(Rhs rhs)
  4. auto opBinary(RhsU rhs)
  5. auto opBinary(Quantity!(RhsU, RhsV) rhs)
  6. auto opBinary(Quantity!(RhsU, RhsV) rhs)
  7. auto opBinary(Quantity!(Unit, RhsV) rhs)
  8. auto opBinary(Quantity!(BaseUnit, RhsV) rhs)
    struct Quantity(Unit, ValueType = double)
    static if(!(!is(Unit.LinearBaseUnit BaseUnit)))
    opBinary
    (
    string op
    RhsV
    )
    if (
    (
    op == "+" ||
    op == "-"
    )
    &&
    is(typeof(mixin ("ValueType.init" ~ op ~ "RhsV.init")))
    )
    if (
    isUnit!Unit
    )
  9. Quantity opOpAssign(Quantity!(BaseUnit, RhsV) rhs)
  10. auto opBinaryRight(Quantity!(BaseUnit, RhsV) lhs)

Examples

auto a = 3 * celsius;
auto b = 2 * kelvin;
assert(a + b == 5 * celsius);
a -= b;
assert(a == 1 * celsius);

Meta