[swift-evolution] Dropping Comparable requirement for indices

David Sweeris davesweeris at mac.com
Wed Jul 6 23:03:56 CDT 2016


> On Jul 6, 2016, at 20:41, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> There is no way, AFAIK, to implement important algorithms like rotate
> binarySearch and several others, without having some representation of
> position within a collection.

Do you need indices to be explicitly comparable for that, or will simply being able to test for equality and being within a "range" work? I realize that in most cases, testing an index for being in a range implies comparable, but what about multi-dimensional indices? Comparison isn't well defined for, say, 2D points, but in theory all the points within a circle or something  could be the indices for something.

- Dave Sweeris


More information about the swift-evolution mailing list