mirror of
https://github.com/apple/swift-collections
synced 2026-11-24 04:27:53 +00:00
2.3 KiB
2.3 KiB
Collections
Swift Collections is an open-source package of data structure implementations for the Swift programming language.
Overview
Modules
- Basic Containers - Defines
UniqueArrayandRigidArray, noncopyable array variants trading some ofArray's flexibility for more predictable performance. - Bit Collections - Defines
BitSetandBitArray, dynamic bit collections. - Deque Module - Defines
Deque<Element>, a double-ended queue backed by a ring buffer. Deques are range-replaceable, mutable, random-access collections. - Heap Module - Defines
Heap, a min-max heap backed by an array, suitable for use as a priority queue. - Ordered Collections - Defines
OrderedSet<Element>, a variant of the standardSetwhere the order of items is well-defined and items can be arbitrarily reordered. Uses aContiguousArrayas its backing store, augmented by a separate hash table of bit packed offsets into it.OrderedDictionary<Key, Value>, an ordered variant of the standardDictionary, providing similar benefits. - Hash Tree Collections - Defines
TreeSetandTreeDictionary, persistent hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). These work similar to the standardSetandDictionary, but they excel at use cases that mutate shared copies, offering dramatic memory savings and radical time improvements. - Trailing Elements Module - Defines
TrailingArray, a low-level, ownership-aware variant ofManagedBuffer, for interoperability with C constructs that consist of a fixed-size header directly followed by variable-size storage buffer.