overlap

@safe pure nothrow @nogc @safe pure nothrow @nogc
inout(T[])
overlap
(
T
)
(
inout(T[]) a
,
inout(T[]) b
)

Return Value

Type: inout(T[])

Slice Overlap of a and b in any order. Deprecated by: std.array.overlap

Examples

1 auto x = [-11_111, 11, 22, 333_333].s;
2 const y = [-22_222, 441, 555, 66].s;
3 
4 assert(!overlap(x, y));
5 assert(!overlap(y, x));
6 
7 auto x01 = x[0..1];
8 auto x12 = x[1..2];
9 auto x23 = x[2..3];
10 
11 // sub-ranges should overlap completely
12 assert(overlap(x, x12) == x12);
13 assert(overlap(x, x01) == x01);
14 assert(overlap(x, x23) == x23);
15 // and commutate f(a,b) == f(b,a)
16 assert(overlap(x01, x) == x01);
17 assert(overlap(x12, x) == x12);
18 assert(overlap(x23, x) == x23);

Meta