RowCol.opBinary

Add, subtract, multiply, or divide one coordinate from another.

  1. RowCol opBinary(RowCol rhs)
    struct RowCol
    @nogc const
    opBinary
    (
    string op
    )
    if (
    op == "+" ||
    op == "-"
    ||
    op == "*"
    ||
    op == "/"
    )
  2. RowCol opBinary(T rhs)
  3. coord_t row;
  4. coord_t col;

Examples

Binary operations can be performed between coordinates.

assert(RowCol(1, 2) + RowCol(4,  1) == RowCol( 5,  3));
assert(RowCol(4, 2) - RowCol(6,  1) == RowCol(-2,  1));
assert(RowCol(4, 2) * RowCol(2, -3) == RowCol( 8, -6));
assert(RowCol(8, 4) / RowCol(2, -4) == RowCol( 4, -1));

Meta