Skip to content

Fix reshaping of a mutable StaticArray #933

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

Merged
merged 2 commits into from
Jul 7, 2021
Merged

Conversation

mateuszbaran
Copy link
Collaborator

This is an attempt to fix the issue described in #907 . I've tried to make changes as limited as possible, so reshape(::AbstractArray, ::Size) still makes a copy. I can change that but doing so is not essential to fixing the key problem, that is reshape(::StaticArray, ::SOneTo...) making a copy, which is fixed here.

This looks like a change that may have some impact on downstream packages so I hope to get some feedback 🙂 .

cc @KristofferC @dlfivefifty @andyferris .

@dlfivefifty
Copy link
Member

My understanding is reshape should never copy...

If this breaks dependent packages this is really a bug in those packages since they shouldn't have assumed it was making a copy.

@KristofferC
Copy link
Contributor

Yes, should be totally fine to fix this bug.

@mateuszbaran
Copy link
Collaborator Author

OK, I've changed it so that no reshape methods (except the one for SArray) make a copy. Let's see how it goes.

@mateuszbaran mateuszbaran merged commit 1c72f5c into master Jul 7, 2021
@mateuszbaran mateuszbaran deleted the mbaran/fix-reshape branch July 7, 2021 19:58
thchr pushed a commit to thchr/StaticArrays.jl that referenced this pull request Jul 8, 2021
* Fix reshaping of a mutable StaticArray

* more reshape changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants