Region.opBinary

Computes the union of all tagged intervals.

  1. Region opBinary(in Region other)
  2. Region opBinary(in TaggedInterval other)
    struct Region(Number, Tag, string tagAlias = null, Tag emptyTag = Tag.init)
    opBinary
    const
    (
    string op
    )
    if (
    op == "|"
    )
  3. Region opBinary(in Region other)
  4. Region opBinary(in TaggedInterval other)

Examples

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

Meta