TaggedInterval.opBinary

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

  1. bool opBinary(TaggedInterval other)
  2. TaggedInterval opBinary(TaggedInterval other)
    struct TaggedInterval
    const pure nothrow
    opBinary
    (
    string op
    )
    if (
    op == "&"
    )
  3. Region opBinary(TaggedInterval other)
  4. bool opBinary(TaggedInterval other)

Examples

alias R = Region!(int, int);
alias TI = R.TaggedInterval;

assert((TI(0, 10, 20) & TI(0, 0, 5)).empty);
assert((TI(0, 10, 20) & TI(0, 5, 15)) == TI(0, 10, 15));
assert((TI(0, 10, 20) & TI(0, 12, 18)) == TI(0, 12, 18));
assert((TI(0, 10, 20) & TI(0, 10, 20)) == TI(0, 10, 20));
assert((TI(0, 10, 20) & TI(0, 15, 25)) == TI(0, 15, 20));
assert((TI(0, 10, 20) & TI(0, 25, 30)).empty);
assert((TI(0, 10, 20) & TI(1, 25, 30)).empty);

Meta