mirror of
https://github.com/apple/swift-collections
synced 2026-11-26 04:47:48 +00:00
Drop support for Swift 6.0 and 6.1
This allows the use of Span types without `#if compiler` guards.
This commit is contained in:
145 files changed
+342
-1047
No files matched your search
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
@frozen
|
||||
@@ -70,7 +69,7 @@ extension _HTable.Bitmap {
|
||||
package func clearAll() {
|
||||
_words.update(repeating: .empty)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package func occupiedCount() -> Int {
|
||||
var c = 0
|
||||
@@ -197,4 +196,3 @@ extension _HTable.Bitmap {
|
||||
return result
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
/// Identifies a particular bucket within a hash table by its offset.
|
||||
/// Having a dedicated wrapper type for this prevents passing a bucket number
|
||||
@@ -102,7 +101,7 @@ extension _HTable.Bucket {
|
||||
package var word: Int {
|
||||
Int(truncatingIfNeeded: offset &>> Word.wordShift)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var bit: UInt {
|
||||
@@ -135,7 +134,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
return _ptr(at: bucket.offset)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _ptr(
|
||||
@@ -143,7 +142,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
) -> UnsafeMutablePointer<Element> {
|
||||
_ptr(at: bucket.offset)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _initializeElement(
|
||||
@@ -152,7 +151,7 @@ extension UnsafeMutableBufferPointer where Element: ~Copyable {
|
||||
) {
|
||||
initializeElement(at: bucket.offset, to: value)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package func _extracting(_ buckets: Range<_HTable.Bucket>) -> Self {
|
||||
@@ -171,5 +170,3 @@ extension Range where Bound == _HTable.Bucket {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
package mutating func consumeAll(
|
||||
@@ -25,5 +23,3 @@ extension _HTable {
|
||||
clear()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
package func maxOccupiedRun() -> Int {
|
||||
if isSmall { return self.count }
|
||||
@@ -61,7 +60,7 @@ extension _HTable {
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
|
||||
package func describe(
|
||||
bitmap: Bool = false,
|
||||
) -> String {
|
||||
@@ -78,11 +77,11 @@ extension _HTable {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
package var description: String {
|
||||
describe()
|
||||
}
|
||||
|
||||
|
||||
package func checkInvariants(
|
||||
failureHandler: (String) -> Void,
|
||||
hashGenerator: (Bucket) -> Int
|
||||
@@ -104,13 +103,13 @@ extension _HTable {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// large
|
||||
let c = bitmap.occupiedCount()
|
||||
if c != self.count {
|
||||
failureHandler("Count does not match bitmap count (count: \(self.count), bitmap: \(c))")
|
||||
}
|
||||
|
||||
|
||||
guard c > 0 else { return }
|
||||
// Start iterating from the first empty bucket, wrapping around once
|
||||
var it = self.makeBucketIterator()
|
||||
@@ -167,4 +166,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#if COLLECTIONS_SINGLE_MODULE
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable.BucketIterator {
|
||||
// FIXME: Remove after 27.0 releases
|
||||
@available(*, deprecated, renamed: "advanceToOccupied(maxCount:)")
|
||||
@@ -58,6 +57,3 @@ extension _HTable.BucketIterator {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
internal func find_Small(
|
||||
@@ -63,4 +62,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -11,7 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
internal mutating func insertNew_Small(
|
||||
@@ -27,8 +26,8 @@ extension _HTable {
|
||||
_maxProbeLength = _count
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@usableFromInline
|
||||
internal mutating func insertNew_Large(
|
||||
hashValue: Int,
|
||||
@@ -37,7 +36,7 @@ extension _HTable {
|
||||
) -> Bucket {
|
||||
assert(!isSmall)
|
||||
assert(!isFull)
|
||||
|
||||
|
||||
#if COLLECTIONS_NO_ROBIN_HOOD_HASHING
|
||||
let ideal = idealBucket(forHashValue: hashValue)
|
||||
let bitmap = self.bitmap
|
||||
@@ -84,4 +83,3 @@ extension _HTable {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
@_lifetime(borrow self)
|
||||
@@ -53,7 +52,7 @@ extension _HTable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package var _bucket: Bucket
|
||||
|
||||
|
||||
/// Remaining bits not yet processed from the last word read.
|
||||
@_alwaysEmitIntoClient
|
||||
package var _nextBits: Word
|
||||
@@ -98,13 +97,13 @@ extension _HTable.BucketIterator {
|
||||
package var currentBucket: Bucket {
|
||||
_bucket
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_transparent
|
||||
package var isAtEnd: Bool {
|
||||
_bucket >= _endBucket
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_transparent
|
||||
package var isOccupied: Bool {
|
||||
@@ -112,7 +111,7 @@ extension _HTable.BucketIterator {
|
||||
if _words == nil { return true }
|
||||
return _nextBits.contains(0)
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func restart() {
|
||||
@@ -123,7 +122,7 @@ extension _HTable.BucketIterator {
|
||||
_nextBitCount = UInt8(Swift.min(Word._capacity, _endBucket._offset))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func _wrap() {
|
||||
@@ -266,7 +265,7 @@ extension _HTable.BucketIterator {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
@_lifetime(self: copy self)
|
||||
package mutating func wrapToOccupied() {
|
||||
@@ -392,4 +391,3 @@ extension _HTable.BucketIterator {
|
||||
return Range(uncheckedBounds: (start, end))
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
/// Create a hole at the specified occupied bucket without marking it as
|
||||
/// unoccupied or restoring the hash table's other invariants. After a hole
|
||||
@@ -25,7 +23,7 @@ extension _HTable {
|
||||
assert(isOccupied(bucket))
|
||||
_count &-= 1
|
||||
}
|
||||
|
||||
|
||||
/// Restore hash table invariants after a hole was created by `createHole`.
|
||||
/// This works by swapping items as needed to move the hole forward until we
|
||||
/// reach the end of the affected chain of occupied buckets.
|
||||
@@ -120,5 +118,3 @@ extension _HTable {
|
||||
return bucket
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
extension _HTable {
|
||||
@usableFromInline
|
||||
package mutating func migrateItems_Small(
|
||||
@@ -23,7 +21,7 @@ extension _HTable {
|
||||
assert(self.isSmall)
|
||||
assert(source.count <= self.capacity)
|
||||
guard !source.isEmpty else { return }
|
||||
|
||||
|
||||
// Let's reverse the order of members, to emphasize that this is not an
|
||||
// ordered container.
|
||||
let c = source.count
|
||||
@@ -41,7 +39,7 @@ extension _HTable {
|
||||
}
|
||||
source.clear()
|
||||
}
|
||||
|
||||
|
||||
@usableFromInline
|
||||
package mutating func migrateItems_Large(
|
||||
from source: inout _HTable,
|
||||
@@ -54,7 +52,7 @@ extension _HTable {
|
||||
assert(!self.isSmall)
|
||||
assert(source.count <= self.capacity)
|
||||
guard !source.isEmpty else { return }
|
||||
|
||||
|
||||
// Move & rehash items one by one.
|
||||
var it = source.makeBucketIterator()
|
||||
while let next = it.nextOccupiedRegion() {
|
||||
@@ -72,5 +70,3 @@ extension _HTable {
|
||||
source.clear()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
extension _HTable {
|
||||
/// The minimum hash table scale.
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -26,7 +25,7 @@ extension _HTable {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The maximum hash table scale.
|
||||
@_alwaysEmitIntoClient
|
||||
package static var maximumScale: UInt8 {
|
||||
@@ -36,7 +35,7 @@ extension _HTable {
|
||||
Swift.min(UInt8(truncatingIfNeeded: Int.bitWidth) &- 1, 56)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// The maximum number of items for which we do not create a hash table.
|
||||
@usableFromInline
|
||||
package static var maximumUnhashedCount: Int {
|
||||
@@ -45,7 +44,7 @@ extension _HTable {
|
||||
maximumCapacity(forScale: 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
@inline(__always)
|
||||
package static func wordCount(forScale scale: UInt8) -> Int {
|
||||
@@ -72,24 +71,24 @@ extension _HTable {
|
||||
// away. This provides hysteresis for storage capacities, preventing hash
|
||||
// tables from repeatedly shrinking/growing when only a handful of items are
|
||||
// added/removed in a loop.
|
||||
|
||||
|
||||
/// The numerator of the maximum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _maxLFNum: UInt { 7 }
|
||||
|
||||
|
||||
/// The denominator of the maximum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _maxLFDenom: UInt { 8 }
|
||||
|
||||
|
||||
/// The numerator of the minimum hash table load factor.
|
||||
@_transparent
|
||||
internal static var _minLFNum: UInt { 1 }
|
||||
|
||||
|
||||
/// The denominator of minimum hash table load factor.
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal static var _minLFDenom: UInt { 8 }
|
||||
|
||||
|
||||
/// The minimum number of items that can be held in a hash table of the given scale.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -99,7 +98,7 @@ extension _HTable {
|
||||
let bucketCount: UInt = 1 &<< scale
|
||||
return Int(bucketCount * _minLFNum / _minLFDenom)
|
||||
}
|
||||
|
||||
|
||||
/// The maximum number of items that can be held in a hash table of the given scale.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -108,8 +107,8 @@ extension _HTable {
|
||||
let bucketCount: UInt = 1 &<< scale
|
||||
return Int(bucketCount * _maxLFNum / _maxLFDenom)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// The minimum hash table scale that can hold the specified number of elements.
|
||||
@usableFromInline
|
||||
@_effects(readnone)
|
||||
@@ -151,4 +150,3 @@ extension _HTable {
|
||||
return (scale, capacity)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -15,7 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
@usableFromInline
|
||||
@frozen
|
||||
package struct _HTable: ~Copyable {
|
||||
@@ -30,13 +29,13 @@ package struct _HTable: ~Copyable {
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package let _bitmap: UnsafeMutablePointer<Word>?
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package var _maxProbeLength: Int
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package let scale: UInt8
|
||||
|
||||
|
||||
// FIXME: Add a reservedScale for UniqueSet/UniqueDictonary
|
||||
|
||||
@inlinable
|
||||
@@ -61,7 +60,7 @@ package struct _HTable: ~Copyable {
|
||||
self._bitmap = bitmap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
internal init(capacity: Int) {
|
||||
assert(capacity >= 0)
|
||||
@@ -69,7 +68,7 @@ package struct _HTable: ~Copyable {
|
||||
_capacity: capacity,
|
||||
scale: Self.minimumScale(forCapacity: capacity))
|
||||
}
|
||||
|
||||
|
||||
@inlinable
|
||||
internal init(minimumCapacity: Int) {
|
||||
precondition(minimumCapacity >= 0, "Capacity must be nonnegative")
|
||||
@@ -77,7 +76,7 @@ package struct _HTable: ~Copyable {
|
||||
self.init(_capacity: p.capacity, scale: p.scale)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
deinit {
|
||||
_bitmap?.deallocate()
|
||||
@@ -115,7 +114,7 @@ extension _HTable {
|
||||
_count == capacity
|
||||
}
|
||||
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var wordCount: Int {
|
||||
@@ -130,7 +129,7 @@ extension _HTable {
|
||||
package var startBucket: Bucket {
|
||||
Bucket(offset: 0)
|
||||
}
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
package var endBucket: Bucket {
|
||||
@@ -149,13 +148,13 @@ extension _HTable {
|
||||
package var bucketCount: UInt {
|
||||
UInt(bitPattern: storageCapacity)
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func isValid(_ bucket: Bucket) -> Bool {
|
||||
bucket._offset < bucketCount
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func wrapBucket(after bucket: inout Bucket) {
|
||||
@@ -180,7 +179,7 @@ extension _HTable {
|
||||
Bitmap(table: self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@_transparent
|
||||
@inlinable
|
||||
package func isOccupied(_ bucket: Bucket) -> Bool {
|
||||
@@ -236,4 +235,3 @@ extension _HTable {
|
||||
&& self.scale == other.scale
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@_alwaysEmitIntoClient
|
||||
@@ -348,7 +346,7 @@ extension RigidArray {
|
||||
var it = self._append(prefixOf: newElements)
|
||||
precondition(it.next() == nil, "RigidArray capacity overflow")
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a borrowing sequence to the end of this array.
|
||||
///
|
||||
@@ -372,4 +370,3 @@ extension RigidArray {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@@ -30,7 +28,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
initializedCount: buffer.count)
|
||||
return _overrideLifetime(result, mutating: &self)
|
||||
}
|
||||
|
||||
|
||||
/// Remove the specified subrange of items from this array,
|
||||
/// passing an input span to the given function to consume them in place.
|
||||
///
|
||||
@@ -57,7 +55,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
let buffer = unsafe _storage.extracting(subrange)
|
||||
var span = InputSpan(buffer: buffer, initializedCount: buffer.count)
|
||||
|
||||
|
||||
consumer(&span)
|
||||
_ = consume span
|
||||
|
||||
@@ -167,15 +165,15 @@ extension RigidArray where Element: ~Copyable {
|
||||
|
||||
@usableFromInline
|
||||
internal var _offsetRange: Range<Int>
|
||||
|
||||
|
||||
@usableFromInline
|
||||
internal var _remainder: UnsafeMutableBufferPointer<Element>
|
||||
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
@_lifetime(&_base)
|
||||
internal init(_base: inout RigidArray, offsetRange: Range<Int>) {
|
||||
|
||||
|
||||
self._remainder = _base._storage._extracting(unchecked: offsetRange)
|
||||
self._base = _MutableRef(&_base)
|
||||
self._offsetRange = offsetRange
|
||||
@@ -184,7 +182,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
deinit {
|
||||
self._remainder.deinitialize()
|
||||
|
||||
|
||||
// FIXME: This needs to be written as
|
||||
// self._base.value.closeGap(offsets: self._offsetRange)
|
||||
// but unfortunately we cannot mutate self in deinit yet.
|
||||
@@ -225,5 +223,3 @@ extension RigidArray.SubrangeConsumer where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// A Boolean value indicating whether this array contains no elements.
|
||||
@@ -442,5 +440,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
return _span(in: Range(uncheckedBounds: (start, index)))
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@available(*, deprecated, renamed: "nextSpan(after:maxCount:)")
|
||||
@@ -76,7 +74,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
return result.take()!
|
||||
}
|
||||
|
||||
|
||||
/// Inserts a given number of new items into this array at the specified
|
||||
/// position, using a callback to directly initialize array storage by
|
||||
/// populating an output span.
|
||||
@@ -140,8 +138,8 @@ extension RigidArray {
|
||||
public func copy() -> Self {
|
||||
clone()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// Copy the contents of this array into a newly allocated rigid array
|
||||
/// instance with the specified capacity.
|
||||
///
|
||||
@@ -240,5 +238,3 @@ extension RigidArray {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
// FIXME: Add this when/if SE-0499 gets implemented.
|
||||
//#if compiler(>=6.x)
|
||||
//@available(SwiftStdlib 5.0, *)
|
||||
@@ -42,6 +40,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -52,5 +50,3 @@ extension RigidArray /*: Equatable */ where Element: Equatable /* & ~Copyable */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
|
||||
#if false // FIXME
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -40,5 +38,3 @@ extension RigidArray where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Initializes a new rigid array with zero capacity and no elements.
|
||||
@@ -28,7 +26,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
_capacity = 0
|
||||
_count = 0
|
||||
}
|
||||
|
||||
|
||||
/// Initializes a new rigid array with the specified capacity and no elements.
|
||||
@inlinable
|
||||
public init(capacity: Int) {
|
||||
@@ -114,7 +112,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.init(capacity: capacity)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -135,9 +133,9 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.init(capacity: capacity)
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -159,7 +157,7 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
try self.append(copying: contents)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/// Creates a new array with the specified capacity, holding a copy
|
||||
/// of the contents of a given collection.
|
||||
///
|
||||
@@ -196,5 +194,3 @@ extension RigidArray /*where Element: Copyable*/ {
|
||||
self.append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Inserts a new element into the array at the specified position.
|
||||
@@ -403,5 +401,3 @@ extension RigidArray {
|
||||
_insertCollection(addingCount: items.count, copying: items, at: index)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
@inlinable
|
||||
@@ -36,5 +34,3 @@ extension RigidArray: Iterable where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Removes all elements from the array, preserving its allocated capacity.
|
||||
@@ -157,5 +155,3 @@ extension RigidArray where Element: ~Copyable {
|
||||
return removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -251,7 +249,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Replaces the specified range of elements by moving the contents of an
|
||||
/// input span into their place. On return, the span is left empty.
|
||||
@@ -595,5 +593,3 @@ extension RigidArray {
|
||||
newCount: newElements.count)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Adds an element to the end of the array.
|
||||
@@ -93,7 +91,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_ensureFreeCapacity(items.count)
|
||||
return _storage._appendUnchecked(moving: items)
|
||||
}
|
||||
|
||||
|
||||
#if UnstableContainersPreview
|
||||
/// Moves the elements of a input span to the end of this array, leaving the
|
||||
/// span empty.
|
||||
@@ -309,7 +307,7 @@ extension UniqueArray {
|
||||
self.append(item)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Copies the elements of a container to the end of this array.
|
||||
///
|
||||
@@ -334,5 +332,3 @@ extension UniqueArray {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if UnstableContainersPreview
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
@@ -128,5 +126,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// A Boolean value indicating whether this array contains no elements.
|
||||
@@ -380,5 +378,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
_storage.previousSpan(before: &index, maxCount: maxCount)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
@available(*, deprecated, renamed: "nextSpan(after:maxCount:)")
|
||||
@@ -99,7 +97,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
}
|
||||
return result.take()!
|
||||
}
|
||||
|
||||
|
||||
/// Inserts a given number of new items into this array at the specified
|
||||
/// position, using a callback to directly initialize array storage by
|
||||
/// populating an output span.
|
||||
@@ -240,7 +238,7 @@ extension UniqueArray {
|
||||
public func copy() -> Self {
|
||||
self.clone()
|
||||
}
|
||||
|
||||
|
||||
/// Copy the contents of this array into a newly allocated unique array
|
||||
/// instance with the specified capacity.
|
||||
///
|
||||
@@ -290,5 +288,3 @@ extension UniqueArray {
|
||||
replaceSubrange(subrange, copying: newElements)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray /*: CustomStringConvertible */ where Element: ~Copyable {
|
||||
public var description: String {
|
||||
@@ -28,5 +26,3 @@ extension UniqueArray /*: CustomDebugStringConvertible */ where Element: ~Copyab
|
||||
"<\(count) items>"
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -51,5 +49,3 @@ extension UniqueArray where Element: Equatable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,7 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2) && UnstableContainersPreview
|
||||
#if UnstableContainersPreview
|
||||
|
||||
#if false // TODO
|
||||
extension UniqueArray /*where Element: Copyable*/ {
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
#if !COLLECTIONS_SINGLE_MODULE
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
@@ -38,5 +36,3 @@ extension UniqueArray where Element: Hashable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Initializes a new unique array with no elements.
|
||||
@@ -24,7 +22,7 @@ extension UniqueArray where Element: ~Copyable {
|
||||
public init() {
|
||||
_storage = .init(capacity: 0)
|
||||
}
|
||||
|
||||
|
||||
/// Initializes a new unique array with the specified capacity and no elements.
|
||||
@inlinable
|
||||
public init(minimumCapacity: Int) {
|
||||
@@ -122,7 +120,7 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
self.init(minimumCapacity: capacity ?? 0)
|
||||
self.append(copying: contents)
|
||||
}
|
||||
|
||||
|
||||
#if compiler(>=6.4)
|
||||
/// Creates a new array with the specified initial capacity, holding a copy
|
||||
/// of the contents of a given container.
|
||||
@@ -162,5 +160,3 @@ extension UniqueArray /*where Element: Copyable*/ {
|
||||
self.append(copying: span)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Inserts a new element into the array at the specified position.
|
||||
@@ -335,5 +333,3 @@ extension UniqueArray {
|
||||
addingCount: newCount, copying: newElements, at: index)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -15,8 +15,6 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Removes all elements from the array, preserving its
|
||||
@@ -141,5 +139,3 @@ extension UniqueArray where Element: ~Copyable {
|
||||
return removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,6 @@ import InternalCollectionsUtilities
|
||||
import SpanPreview
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.2)
|
||||
|
||||
@available(SwiftStdlib 5.0, *)
|
||||
extension UniqueArray where Element: ~Copyable {
|
||||
/// Replaces the specified range of elements by a given count of new items,
|
||||
@@ -468,7 +466,7 @@ extension UniqueArray {
|
||||
_ensureFreeCapacity(newElements.count - subrange.count)
|
||||
return _storage.replaceSubrange(subrange, copying: newElements)
|
||||
}
|
||||
|
||||
|
||||
/// Replaces the specified subrange of elements by copying the elements of
|
||||
/// the given collection.
|
||||
///
|
||||
@@ -513,4 +511,3 @@ extension UniqueArray {
|
||||
newCount: c)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user