Open danakj opened 1 year ago
Can we compare the address of Iter::nth() to IteratorBase::nth to determine if we should branch and call the Iter overload from IteratorBase::nth?
It would loop forever if it was overloaded and called up to the IteratorBase but just don't do that.
Slice iterators need to be able to perform nth() in O(1) time, which means Iterator needs to be able to delegate from the default impl to a specific one.
There's a few other important methods like that as well. Then aggressively use those methods from the default methods if there's any opportunities to do so that aren't done yet (mostly they should already be).
fold is also optimized for some iterators in std.rs I believe.