I don't think a just iterated array is automatically set to null, so taking it's pointer won't hit a memory-proteted area. So undeprectating arr.ptr in @safe would break @safety and be a step backward.

If this is an issue, one can define a @trusted function which takes a starting pointer from array and casts it to size_t before returning it so memory corruption cannot happen via it.

On Tuesday, 27 February 2018 at 09:47:51 UTC, Stefan Koch wrote:
Checking if an array is the slice of another.

For that there is also std.array.overlap().


Reply via email to