On Saturday, 28 December 2013 at 17:53:31 UTC, Chris Cain wrote:
How is that significantly different than the current situation?
It is different in the sense that if your lengths are short you either have to write your own container or your own algorithm because the algorithm designer assumed that walkLength would be too slow in all cases? In the case of phobos you probably could just change the algorithm to use walkLength yourself and include it with your source. In a more complex framework it might be more difficult?
FYI, if your thing defines length, then walkLength calls it. So it's effectively as fast to use when your thing has length defined, otherwise it suggests that you understand that a relaxed constraint of O(N) is acceptable and will do that for you if length doesn't exist.
Yes, but I still think that all containers should have length() regardless of efficiency because that is more intuitive, and then you might either provide properties that can be used to assess performance or define a lengthFast() for those algorithms that require O(1).
