[swift-dev] [Issue] Collection.distance() works not very well in some situations
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`!)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev