Skip to content

Commit

Permalink
Prefer Array over ContiguousArray for public API
Browse files Browse the repository at this point in the history
  • Loading branch information
ejmarchant committed Aug 20, 2021
1 parent 872010e commit 91b0863
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension SparseSet.Elements.SubSequence {
/// - Complexity: O(1)
@inlinable
@inline(__always)
public var keys: ContiguousArray<Key>.SubSequence {
public var keys: Array<Key>.SubSequence {
_base.keys[_bounds]
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/SparseSetModule/SparseSet+Elements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ extension SparseSet.Elements {
/// - Complexity: O(1)
@inlinable
@inline(__always)
public var keys: ContiguousArray<Key> {
_base._dense._keys
public var keys: Array<Key> {
Array(_base._dense._keys)
}

/// A mutable collection view containing the values in this collection.
Expand Down
6 changes: 3 additions & 3 deletions Sources/SparseSetModule/SparseSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public struct SparseSet<Key, Value> where Key: FixedWidthInteger, Key.Stride ==

extension SparseSet {
/// A read-only collection view for the keys contained in this sparse set, as
/// a `ContiguousArray`.
/// an `Array`.
///
/// - Complexity: O(1)
@inlinable
@inline(__always)
public var keys: ContiguousArray<Key> {
_dense._keys
public var keys: Array<Key> {
Array(_dense._keys)
}

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

0 comments on commit 91b0863

Please sign in to comment.