Skip to content

Implement nth and nth_back for list and tuple iterators #4787

@ngoldbaum

Description

@ngoldbaum

Right now BoundListIterator::nth will call next n times (I think, please correct me if I'm misinterpreting), when instead it could get the nth item immediately. We should override Iterator::nth and DoubleEndedIterator::nth_back on stable rust and Iterator::advance_by and DoubleEndedIterator::advance_back_by on nightly rust to do constant-time indexing for all of the list and tuple iterator stucts.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions