-
Notifications
You must be signed in to change notification settings - Fork 323
Are non-contiguous owned arrays safe? #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, this use-case has been considered, and this capability is useful in some cases (see e.g. #425). In addition to Is this safe? Yes. You might be concerned that elements outside the visible area of the array could be uninitialized and get dropped. However, owned arrays store their data in a There are some tests involving discontiguous views, but I don't see any involving discontiguous owned arrays. Would you like to add some? :) I'd be happy for a PR adding more tests. |
Nope, nothing in particular. When I discovered this, one of the first things I did was search for Drop impls (and was relieved not to find any), but I still wanted to ask just to be certain. The breadth of other methods that can do this is reassuring. This is a neat property of the design of
Sure! I'll start putting something together. |
For what it's worth, owned arrays in |
I guess that support for this feature also explains why there's no |
ndarray itself should handle this correctly, since it's a feature since the start of the library. |
I won't wait for #444 to close this, as it is clear that the this has been an integral part of the library's design from day one. |
slice_inplace
. This seems to me like an incredibly niche use case that might not have been anticipated in other code.Basically, I'm just asking: Has this use case been considered, or is this "feature" of
slice_inplace
accidental?The text was updated successfully, but these errors were encountered: