Quantity.opOpAssign

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

  1. Quantity opOpAssign(Quantity!(Unit, RhsV) rhs)
  2. Quantity opOpAssign(T rhs)
  3. Quantity opOpAssign(Quantity!(BaseUnit, RhsV) rhs)
    struct Quantity(Unit, ValueType = double)
    ref
    static if(!(!is(Unit.LinearBaseUnit BaseUnit)))
    opOpAssign
    (
    string op
    RhsV
    )
    if (
    (
    op == "+" ||
    op == "-"
    )
    &&
    __traits(compiles, ())
    )
    if (
    isUnit!Unit
    )
  4. auto opBinary(Quantity!(BaseUnit, RhsV) rhs)
  5. 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