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

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

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

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

// sub-ranges should overlap completely
assert(overlap(x, x12) == x12);
assert(overlap(x, x01) == x01);
assert(overlap(x, x23) == x23);
// and commutate f(a,b) == f(b,a)
assert(overlap(x01, x) == x01);
assert(overlap(x12, x) == x12);
assert(overlap(x23, x) == x23);

Meta