mirror of
https://github.com/apple/swift-collections
synced 2026-11-27 04:54:21 +00:00
Final touch up, polishes, and optimizations.
Key Changes: - Add duplicate handling functionality to _BTree.Builder - Remove transient allocation in SortedDictionary.values _modify - Add missing SortedDictionary.Values.subscript _modify - Add SortedSet(sortedElements:) - Add optimized SetAlgebra implementations - Remove remaining high-level offset APIs - Various optimizations - Expand internal documentation Minor Changes: - Add ability to create dummy node - _BTree.Builder.append(key: Key) for sets. - Fix bug where findAnyIndex(forKey:) didn't calculate the offset. - Remove old, unused files - findAnyCursor -> takeCursor (to emphasize consuming nature) - Add takeCursor(at: Index) - Optimize init(grouping:by:) to use modifyValue to reduce CoW Optimizations: - Use dummy node for transient _modify state rather than allocating new buffer
This commit is contained in:
30 files changed
+691
-282
No files matched your search
@@ -35,23 +35,3 @@ public struct SortedSet<Element: Comparable> {
|
||||
self._root = tree
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Testing for Membership
|
||||
|
||||
// MARK: Adding Elements
|
||||
extension SortedSet {
|
||||
// TODO: document
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
@discardableResult
|
||||
public mutating func remove(atOffset offset: Int) -> Element {
|
||||
return self._root.remove(atOffset: offset).key
|
||||
}
|
||||
|
||||
// TODO: document
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
public subscript(offset absoluteOffset: Int) -> Element {
|
||||
return self._root.index(atOffset: absoluteOffset).element.key
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user