Skip to content

IntoIterator on ArrayBase #196

Closed

Description

@CryZe

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.

Activity

  1. bluss commented on May 10, 2016

    @bluss
    Member

    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.

  2. bluss commented on Sep 26, 2016

    @bluss
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions