[swift-evolution] Adding a new filter method which returns 2 arrays
davesweeris at mac.com
davesweeris at mac.com
Fri Jan 15 21:31:29 CST 2016
Yeah… If the “optimized” route isn’t available, I don’t think trying to fake it is worth adding complexity to *Arrays*. If this were some heavy-weight object where it already has tons of overhead, then maybe, but not something as relatively basic and low-level as an Array.
- Dave Sweeris
> On Jan 15, 2016, at 19:03, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>
>> We can also do the optimized way which isn't so user-friendly: make a new structure that contains an array and an index internally. The array will be the original array just "sorted" based on the predicate function. And the index is for where the second half starts. The public API would show 2 arrays somehow and gives the illusion that there are 2 arrays.
>
> The problem is, you would still need some kind of array to tell you which elements fell into each partition. So I don't think that helps us very much.
>
>
> --
> Brent Royal-Gordon
> Architechies
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list