v3.1.0
This is a feature release extending the functionality of SortedSet
and Map
with several new methods.
New Features
SortedSet
Offset-based access
SortedSet.offset(of:)
returns the offset to a particular member of the set.SortedSet.remove(atOffset:)
removes and returns the element at a particular offset in the set.
Range-based operations
SortedSet.count(elementsIn:)
returns the number of elements in the given open or closed range.SortedSet.intersection(elementsIn:)
returns the result of intersecting the set with a given open or closed range.SortedSet.formIntersection(elementsIn:)
is the in-place editing version of the above.SortedSet.subtracting(elementsIn:)
returns a set without members in the given open or closed range.SortedSet.subtract(elementsIn:)
is the in-place editing version of the previous method.
Shifting
SortedSet.shift(startingAt start: Element, by delta: Element.Stride)
is a new method for sorted sets with strideable elements. It addsdelta
to every element in the set that is greater than or equal tostart
. The elements are modified in place.
All of these new methods run in logarithmic time, except for shift
whose complexity is linear.
Map
Map.offset(of:)
is a new method for finding the offset of a particular key in the map. It has logarithmic complexity.
Bug fixes
- The tvOS target now generates a framework that is explicitly restricted to only use extension-safe API.