Quantity.opCmp

Comparison with another quantity of the same unit.

  1. int opEquals(Quantity!(Unit, RhsV) rhs)
  2. auto opCmp(Quantity!(Unit, RhsV) rhs)
    struct Quantity(Unit, ValueType = double)
    opCmp
    (
    RhsV
    )
    (
    Quantity!(Unit, RhsV) rhs
    )
    if (
    is(typeof(ValueType.init < RhsV.init) : bool)
    )
    if (
    isUnit!Unit
    )

Examples

auto a = 3 * metre;
auto b = 4 * metre;
auto c = 5 * second;
assert(a != b);
assert(a < b);
assert(!__traits(compiles, a != c));
assert(!__traits(compiles, a < c));

Meta