overlaps

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

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

Examples

1 auto x = [-11_111, 11, 22, 333_333].s;
2 const y = [-22_222, 441, 555, 66].s;
3 
4 assert(!overlaps(x, y));
5 assert(!overlaps(y, x));
6 
7 auto x01 = x[0..1];
8 auto x12 = x[1..2];
9 auto x23 = x[2..3];
10 
11 assert(overlaps(x, x12));
12 assert(overlaps(x, x01));
13 assert(overlaps(x, x23));
14 assert(overlaps(x01, x));
15 assert(overlaps(x12, x));
16 assert(overlaps(x23, x));

Meta