TaggedInterval.opBinary

Returns the difference of both intervals.

  1. TaggedInterval opBinary(in TaggedInterval other)
  2. Region opBinary(in TaggedInterval other)
    struct TaggedInterval
    opBinary
    const
    (
    string op
    )
    if (
    op == "-"
    )
  3. bool opBinary(in TaggedInterval other)

Examples

1 alias R = Region!(int, int);
2 alias TI = R.TaggedInterval;
3 
4 assert(TI(0, 10, 20) - TI(0, 0, 5) == R([TI(0, 10, 20)]));
5 assert(TI(0, 10, 20) - TI(0, 5, 15) == R([TI(0, 15, 20)]));
6 assert(TI(0, 10, 20) - TI(0, 12, 18) == R([TI(0, 10, 12), TI(0, 18, 20)]));
7 assert(TI(0, 10, 20) - TI(0, 10, 20) == R([]));
8 assert(TI(0, 10, 20) - TI(0, 15, 25) == R([TI(0, 10, 15)]));
9 assert(TI(0, 10, 20) - TI(0, 25, 30) == R([TI(0, 10, 20)]));
10 assert(TI(0, 10, 20) - TI(1, 25, 30) == R([TI(0, 10, 20)]));

Meta