-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
featureA feature request or implementationA feature request or implementationimprovementstandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift evolution implementedFlag → feature: A feature that was approved through the Swift evolution process and implementedFlag → feature: A feature that was approved through the Swift evolution process and implemented
Description
Previous ID | SR-3087 |
Radar | rdar://problem/21880692 |
Original Reporter | @karwa |
Type | Improvement |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | Improvement, LanguageFeatureRequest |
Assignee | @natecook1000 |
Priority | Medium |
md5: 78d2891e46bb0f408db15202b1a1b736
relates to:
- SR-3631 Introduce ContiguouslyStored protocol and kill ArraySlice type
Issue Description:
The standard library does not currently expose a way to allocate an Array's storage and (unsafely) initialise its elements, as we can with UnsafeMutablePointer.
An example use-case is to implement a concurrent map. See: https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20161024/003769.html
Even though we expose a UMP from Array, it cannot be used to unsafely initialise the Array elements.
The workaround at the moment is to allocate a UMP, initialise its elements unsafely, and then copy the contents in to an Array via the Array(Sequence) constructor, which is less than optimal.
Metadata
Metadata
Assignees
Labels
featureA feature request or implementationA feature request or implementationimprovementstandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift evolution implementedFlag → feature: A feature that was approved through the Swift evolution process and implementedFlag → feature: A feature that was approved through the Swift evolution process and implemented