https://github.com/apple/swift/pull/3819 <https://github.com/apple/swift/pull/3819>
> As I understand it, Array may be backed by contiguous storage (if native) or > it may be backed by some exotic NSArray subclass. We provide a related type > with stronger backing guarantees: ContiguousArray (and indeed, in my > algorithmic code, I can see a total execution time halve by switching from > one to the other -- which may be a bug, but in any case there are differences > which is why we have the type in the first place). > > Unfortunately, there is no way to vend a ContiguousArray as a regular Array. > If you wish to make use of the stronger guarantees of ContiguousArray in your > algorithm, everybody who uses those results must also use ContiguousArray or > else you will have to copy the data. > > I know it's late for Swift 3. I literally only noticed this today, otherwise > I would have mentioned it earlier. > > It seems like a reasonably large hole with a simple fix. Going from > ContiguousArray to Array is a kind-of upcasting conversion and should be > allowed -- it seems like that's almost the whole point of the type. >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
