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
I suppose it might not be, though it could be counting when constructed
Dec 3, 2020 ยท 11:25 PM UTC


