Thanks, that was helpful. I suspect the reason it ends up being dead weight is that it doesn't make much sense to prevent an API customer from using an iterator with certain performance characteristics with certain algorithms. Ultimately, the onus is on the developer to know something about the data; for instance, why wouldn't I be allowed to use any iteration algorithm on my slow-to-increment iterator if I know the length is 1?
So long as it's safe I think it's on the designer to make sure it's efficient, and I suspect that's where the API has gravitated to.
So long as it's safe I think it's on the designer to make sure it's efficient, and I suspect that's where the API has gravitated to.