sameHead

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

@safe pure nothrow @nogc
bool
sameHead
(
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 lhs.ptr == rhs.ptr, false otherwise.

Examples

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

assert(a.sameHead(b));

Meta