[swift-dev] [Issue] Collection.distance() works not very well in some situations
Brent Royal-Gordon
brent at architechies.com
Mon Dec 4 20:37:46 CST 2017
> On Dec 2, 2017, at 12:28 PM, Cao, Jiannan via swift-dev <swift-dev at swift.org> wrote:
>
> The question is that, whether the original Collection Protocol requires index from lower to higher (startIndex < endIndex).
`Collection` does require that `startIndex <= endIndex`, and in general, that `i < c.index(after: i)` for all `i` in `c.startIndex ..< c.endIndex`. Unfortunately, this may not be explicitly documented anywhere.
(Also unfortunately, `index(after:)` doesn't appear at all in Apple's documentation for `Collection`!)
--
Brent Royal-Gordon
Architechies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20171204/1b7d1965/attachment.html>
More information about the swift-dev
mailing list