Until now there was no public API to efficiently return the elements from the underlying storage of IdentifiedArray as an [Element], requiring an O(n)map { $0 } via Collection to achieve this.
By taking advantage of the existing O(1)OrderedDictionary.values and OrderedDictionary.Values.elements getters, we can efficiently provide an O(1) read-only view of the elements in a more ergonomic way.
Changes
Add new read-only elements getter to IdentifiedArray.
Until now there was no public API to efficiently return the elements from the underlying storage of
IdentifiedArray
as an[Element]
, requiring anO(n)
map { $0 }
viaCollection
to achieve this.By taking advantage of the existing
O(1)
OrderedDictionary.values
andOrderedDictionary.Values.elements
getters, we can efficiently provide anO(1)
read-only view of the elements in a more ergonomic way.Changes
elements
getter toIdentifiedArray
.