[swift-evolution] Adding a new filter method which returns 2 arrays

Brent Royal-Gordon brent at architechies.com
Fri Jan 15 21:03:20 CST 2016


> 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



More information about the swift-evolution mailing list