Skip to content

v3.1.0

Compare
Choose a tag to compare
@lorentey lorentey released this 06 Oct 11:19
· 78 commits to master since this release

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 adds delta to every element in the set that is greater than or equal to start. 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.