Denis Koroskin wrote:auto x = p1 - p2;What's the type of x?ptrdiff_t, signed counterpart of size_tDo you really want an error if you go: size_t y = p1 - p2; ?
Of course, what sense does it make when p2 > p1?I'd put an assert and mad a case explicit, if there is a size_t is so badly needed for ptr difference:
assert(p1 >= p2); size_t y = cast(size_t)p1 - p2;
