Skip to content

Commit 91b0863

Browse files
committed
Prefer Array over ContiguousArray for public API
1 parent 872010e commit 91b0863

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Sources/SparseSetModule/SparseSet+Elements+SubSequence.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension SparseSet.Elements.SubSequence {
3636
/// - Complexity: O(1)
3737
@inlinable
3838
@inline(__always)
39-
public var keys: ContiguousArray<Key>.SubSequence {
39+
public var keys: Array<Key>.SubSequence {
4040
_base.keys[_bounds]
4141
}
4242

Sources/SparseSetModule/SparseSet+Elements.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ extension SparseSet.Elements {
4949
/// - Complexity: O(1)
5050
@inlinable
5151
@inline(__always)
52-
public var keys: ContiguousArray<Key> {
53-
_base._dense._keys
52+
public var keys: Array<Key> {
53+
Array(_base._dense._keys)
5454
}
5555

5656
/// A mutable collection view containing the values in this collection.

Sources/SparseSetModule/SparseSet.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public struct SparseSet<Key, Value> where Key: FixedWidthInteger, Key.Stride ==
3232

3333
extension SparseSet {
3434
/// A read-only collection view for the keys contained in this sparse set, as
35-
/// a `ContiguousArray`.
35+
/// an `Array`.
3636
///
3737
/// - Complexity: O(1)
3838
@inlinable
3939
@inline(__always)
40-
public var keys: ContiguousArray<Key> {
41-
_dense._keys
40+
public var keys: Array<Key> {
41+
Array(_dense._keys)
4242
}
4343

4444
/// A mutable collection view containing the values in this sparse set.

0 commit comments

Comments
 (0)