TaggedInterval.opOpAssign

Returns the intersection of both intervals; empty if tags differ.

  1. TaggedInterval opBinary(in TaggedInterval other)
  2. TaggedInterval opOpAssign(in TaggedInterval other)
    struct TaggedInterval
    opOpAssign
    (
    string op
    )
    if (
    op == "&"
    )

Examples

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

Meta