Skip to content

IntoIterator on ArrayBase #196

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

Closed
CryZe opened this issue May 9, 2016 · 2 comments · Fixed by #986
Closed

IntoIterator on ArrayBase #196

CryZe opened this issue May 9, 2016 · 2 comments · Fixed by #986

Comments

@CryZe
Copy link

CryZe commented May 9, 2016

Why is there no IntoIterator implementation for ArrayBase itself? I want to collect all elements into another data structure (or just map its type, but that's not available either), but all I can access are references of the elements, which is kind of bad. I could use mem::replace, but that requires me to create dummy values, which is bad for performance. So I'd like to just consume the whole thing and collect it into a new data structure instead.

@bluss
Copy link
Member

bluss commented May 10, 2016

ok, so the question is about a consuming by-value iterator on OwnedArray. What's your element type? Depending on it, it may not be so expensive.

The general question of a consuming iterator for OwnedArray is not so simple when you factor in other memory layouts apart from the regular ones, but those complications only affect the complexity of the implementation, and should not impact the performance of the eventual solution.. I hope.

@bluss
Copy link
Member

bluss commented Sep 26, 2016

Array::into_raw_vec now exists, but it has the major caveats about using the internal memory order. It would not be a good by value IntoIterator since its element order does not always match .iter().

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

Successfully merging a pull request may close this issue.

2 participants