Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Expand .zip() specialization to .map() and .cloned() #37230
Implement .zip() specialization for Map and Cloned.
The crucial thing for transparent specialization is that we want to
The simplest example is that in this code snippet:
I don't feel this is ready yet. @Stebalien, do you want to review it? Maybe there's a simpler way?
Extending this to .map() is worth a bit of complexity, but it also casts doubt on if we can make TrustedRandomAccess into a publically available trait (?). If it gets too complex to use, I mean. The bulk of the complexity here is not in the implementations of that specialization trait though, but instead in
The testcases should demonstrate why keeping track of the side effects is a bit ugly. One can't just specializal case .next() and let .next_back() be.
I thought back to the "next_unchecked()" proposal but I don't think it helps -- it still needs to keep track of the length and number of elements taken the same way.