overlaps

Detect overlap between this interval and other given interval in a half-open coordinate system [start, end)

Top-level function template for reuse by many types of Interval objects Template type parameter Interval Type must have {start, end} Still usable with member-function style due to UFCS: interval.overlaps(other)

return true in any of the following four situations: int1 ===== ======= int2 ======= =======

int1 ======= ======= int2 === =======

return false in any other scenario: int1 ===== | ===== int2 ===== | =====

NOTE that in half-open coordinates [start, end) i1.end == i2.start => Adjacent, but NO overlap

@nogc pure @safe nothrow
bool
overlaps
(
IntervalType1
IntervalType2
)
(
IntervalType1 int1
,
IntervalType2 int2
)
if (
__traits(hasMember, IntervalType1, "start") &&
__traits(hasMember, IntervalType1, "end")
&&
__traits(hasMember, IntervalType2, "start")
&&
__traits(hasMember, IntervalType2, "end")
)

Meta