Hello,
Is there a safe(r) way of checking whether two slices point to the
same underlying array than going through unsafe.Pointer and casting
the result to reflect.SliceHeader?
I have a solution that works, but I'm not sure how to interpret the
SliceHeader warning: "It cannot be used safely or portably." Is that
in reference to different architectures, Go compilers, Go versions, or
all of the above?
A demo of my solution is here, but you have to run it locally due to
the unsafe import:
http://play.golang.org/p/gwJtKK__gG
One function tells you if two byte slices share the same array.
Another returns the overlapping region, if there is one.
- Max