for iterators in @rustlang does s.chars().cycle().nth(absurdly_high_number) allocate for every number up to absurdly_high_number? or is it smart enough to pick the value in the cycle that would be at that position?
4
2
17
Currently I imagine it's not efficient, though with specialisation perhaps the Cycle struct could have an impl for .nth() if you're cycling an exact length iterator to compute the offset?
1
1
Chars can't be an ExactLenthIterator though, can it?
1
1
Replying to @leo60228
I suppose it might not be, though it could be counting when constructed

Dec 3, 2020 ยท 11:25 PM UTC