Skip to content

random access iterators should implement a better version of nth() #17348

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
awelkie opened this issue Sep 17, 2014 · 3 comments
Closed

random access iterators should implement a better version of nth() #17348

awelkie opened this issue Sep 17, 2014 · 3 comments
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.

Comments

@awelkie
Copy link

awelkie commented Sep 17, 2014

Right now, the Items struct uses the default version of the nth method for Iterators. But this makes repeated calls to next(), which is unnecessary for Items. The Items struct should use it's own version that skips directly to the nth offset element.

@thestinger thestinger changed the title Items should implement a better version of nth() random access iterators should implement a better version of nth() Sep 18, 2014
@thestinger thestinger added A-libs I-slow Issue: Problems and improvements with respect to performance of generated code. labels Sep 18, 2014
@frewsxcv
Copy link
Member

Which 'Items struct' are you referring to?

@Gankra
Copy link
Contributor

Gankra commented Feb 23, 2015

This is likely in reference to what is now std::vec::Iter, but really it's applicable to all RandomAccessIterators. There's some mumbling of just dropping RAI as a trait for now pending better design/motivation (it's currently marked as unstable iirc).

@steveklabnik
Copy link
Member

RandomAccessIterator is now gone, so closing.

lnicola pushed a commit to lnicola/rust that referenced this issue Jun 23, 2024
…urce, r=Veykril

Use `.get(…)` instead of `[…]` in `TypeOrConstParam::source(…)` and `LifetimeParam::source(…)`

Resolves rust-lang#17344.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-slow Issue: Problems and improvements with respect to performance of generated code.
Projects
None yet
Development

No branches or pull requests

5 participants