tera
1
is there Array's (or perhaps Collection's?) equivalent of Foundation's:
NSArray method:
func index(of obj: Any, inSortedRange r: NSRange, options opts: NSBinarySearchingOptions = [], usingComparator cmp: (Any, Any) -> ComparisonResult) -> Int
pyrtsa
(Pyry Jahkola)
2
Not in the stdlib publicly AFAICT, but swift-algorithms provides a binary search to sorted random access collections by the name of partitioningIndex(where:). swift-algorithms/Partition.md at main · apple/swift-algorithms · GitHub
2 Likes