The OpenD Programming Language

sameTail

Returns whether the backs of lhs and rhs both refer to the same place in memory, making one of the arrays a slice of the other which end at index $.

@trusted pure nothrow @nogc
bool
sameTail
(
T
)
(
in T[] lhs
,
in T[] rhs
)

Parameters

lhs T[]

the first array to compare

rhs T[]

the second array to compare

Return Value

Type: bool

true if both arrays are the same length and lhs.ptr == rhs.ptr, false otherwise.

Examples

auto a = [1, 2, 3, 4, 5];
auto b = a[3..$];

assert(a.sameTail(b));

Meta