Quantity.opBinary

Multplication/division by a plain value (i.e. a dimensionless quantity not represented by a Quantity instance).

  1. auto opBinary(Quantity!(Unit, RhsV) rhs)
  2. auto opBinary(T rhs)
    struct Quantity(Unit, ValueType = double)
    static if(!is(Unit.LinearBaseUnit BaseUnit))
    opBinary
    (
    string op
    T
    )
    (
    T rhs
    )
    if (
    (
    op == "*" ||
    op == "/"
    )
    &&
    !isUnit!T
    &&
    !isQuantity!T
    &&
    is(typeof(mixin ("ValueType.init" ~ op ~ "T.init")))
    )
    if (
    isUnit!Unit
    )
  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)
  9. auto opBinaryRight(T lhs)
  10. Quantity opOpAssign(T rhs)

Examples

auto l = 6 * metre;
assert(l * 2 == 12 * metre);
l /= 2;
assert(l == 3 * metre);

Meta