overlaps

Helper for overlap(). Copied from std.array with simplified return expression.

pure nothrow @safe @nogc @trusted pure nothrow @nogc
bool
overlaps
(
T
)
(
in T[] r1
,
in T[] r2
)

Examples

auto x = [-11_111, 11, 22, 333_333].s;
const y = [-22_222, 441, 555, 66].s;

assert(!overlaps(x, y));
assert(!overlaps(y, x));

auto x01 = x[0..1];
auto x12 = x[1..2];
auto x23 = x[2..3];

assert(overlaps(x, x12));
assert(overlaps(x, x01));
assert(overlaps(x, x23));
assert(overlaps(x01, x));
assert(overlaps(x12, x));
assert(overlaps(x23, x));

Meta